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

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


GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context)

is deprecated!

Use:

 GoogleApiAvailability api = GoogleApiAvailability.getInstance();        int code = api.isGooglePlayServicesAvailable(activity);        if (code == ConnectionResult.SUCCESS) {           // Do Your Stuff Here        } else {           AlertDialog alertDialog =                 new AlertDialog.Builder(activity, R.style.AppCompatAlertDialogStyle).setMessage(                       "You need to download Google Play Services in order to use this part of the application")                       .create();           alertDialog.show();        }


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.


If your app uses GMS features like Google Sign-In or Firebase Cloud Messaging, it won't work well on the devices that don't have GMS.It's recommended that you use GMS if a device supports GMS; otherwise, use HMS (Huawei Mobile Services).

Please refer to the following links:

So you can use Google+ Sign-In on the devices where GMS is available; otherwise, use HUAWEI Account Sign-In.