Nicolas Raoul Nicolas Raoul - 2 years ago 109
Android Question

Google Play services: How to handle devices that do not have Google Play?

Google Play services is an Android library whose goal is to provide:

  • OAuth 2.0 authentication

  • Google+ sign-in

  • Google+ +1 button

  • various other goodies

If I decide to use it (for instance because I want Google+ sign-in), then I wonder what will happen to users whose device does not have Google Play (Nook, Cyanogenmod, China Mobile, old devices, etc).

I guess the application will not be able to use the library on such devices.

QUESTION: Furthermore, will the application become incompatible with such devices?

Is there a best practice to keep this in mind when using Google Play services?

Answer Source

If the feature from Google Play Services is essential for your app there would be no way to get your App working.

You can check if the services are enabled from within your app with GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context)
which returns ConnectionResult.SUCCESS if Play Services is available.

You can now try to convince the user to install it (if possible) or disable the feature that is using the service.

As the Google Play Services is not a feature declared in the manifest your app should install fine on any device but may crash later on if you are using the APIs without checking if they are available.

You can try the behaviour with the emulator. Just create an AVD without the Google APIs and put your App on it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download