Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the fall back plan for devices without Google Play Services

Currently, I'm migrating previous Google services which makes use of jar library to Google Play Services.

  • Google AdMob
  • Google Analytics
  • Google Drive

However, in migration guide, Google doesn't mention what we should do, for devices without Google Play Services, or without up-to-dated Google Play Services.

So, should we just ignore users without Google Play Services, or there is a fall back plan?

Having to maintain separate set of jar files and legacy code for fall back plan is quite cumbersome. Also, there might be conflicting issues, having jar files and GPS side by side. Utilize both Play Services and AdMob SDK

like image 973
Cheok Yan Cheng Avatar asked May 15 '14 11:05

Cheok Yan Cheng


People also ask

What would you do without Google Play Services?

They have left no escape way; what one would do with an Android device without Google Play services location APIs (for High Accuracy) and online Contacts backup, just to name a few. There are a number of Google API's including Analytics, Ads, Authentication, Location, SafetyNet, CloudMessaging and many more.

What is an example of Google Play Services?

Examples include carrier services, Android Auto, many apps that send notifications, most navigation apps, and others. You’ll have to get new apps from sources outside the Google Play Store. Is it okay to clear the Google Play Services cache and data?

What are the best alternatives to Google Play Store?

One such Google Play Store alternative is F-droid. This app store contains free and open source Android apps. F-droid is popular among developers, and the store includes a vast collection of different apps. Then there is APKMirror — an Android apps website, encompassing thousands of apps on Google Play Store.

What happens if you don’t download apps from Google Play Store?

However, if you did, a lot of stuff on your phone would cease to function correctly. Examples include carrier services, Android Auto, many apps that send notifications, most navigation apps, and others. You’ll have to get new apps from sources outside the Google Play Store.


2 Answers

1. Checking for Google Play Services

As documented here you should always ensure that:

  1. The Google Play Services APK is present at all.
  2. That the correct version is installed.

Mostly you would perform those checks in the onResume() method. The GooglePlayServiceUtils has a method called isGooglePlayServicesAvailable(...) that checks both if the Google Play Services are installed and that they are the correct version. It returns an int error code that tells you roughly what's wrong:

@Override
public void onResume() {
    super.onResume();

    int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
    switch(errorCode) {
        case ConnectionResult.SUCCESS:
            // Google Play Services installed and up to date
            break;

        case ConnectionResult.SERVICE_MISSING:
            // Google Play services is missing on this device.
            break;

        case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
            // The installed version of Google Play services is out of date.
            break;

        case ConnectionResult.SERVICE_DISABLED:
            // The installed version of Google Play services has been disabled on this device.
            break;

        case ConnectionResult.SERVICE_INVALID:
            // The version of the Google Play services installed on this device is not authentic.
            break;

        case ConnectionResult.DATE_INVALID:
            // The device date is likely set incorrectly.
            break;          
    }
}

You can use a method like showErrorDialogFragment(...) of the GooglePlayServiceUtils to show an appropriate error message:

int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
if(GooglePlayServiceUtil.showErrorDialogFragment(errorCode, getActivity(), REQUEST_CODE)) {
    // Dialog was shown
} else {
    // Dialog was not shown.
}

The dialog is only shown when the error code is something other than ConnectionResult.SUCCESS.

You can find documentation for the GooglePlayServiceUtil class here.

2. Fallback

Whether you need a fallback depends solely on your app and the market you are targeting. For example if you publish it to the Google Play Store - which I assume you do since you use Google Play Services - then you don't really need a fallback. Because for people to download your app they first need the Google Play Store, and if they have the Google Play Store than they have access to the Google Play Services. It's of course a whole different story if you want to publish it for Amazon devices, or in the Nokia Store, because devices that have those don't have the Google Play Store or Google Play Services. Also in markets like China there are hardly any Android devices with the Google Play Store or any Google Services, so essentially you have to decide if it is necessary for your app, but as I said if you publish it to the Google Play Store I wouldn't worry about it. The checks and also the error dialog I mentioned above should be more than enough to ensure that your app works well. The rollout of new versions of the Google Play Services APK is normally pretty quick. It might take a few days, but after that most devices have received the update. You also have to think about one thing: If you develop your app to require features of the current Google Play Services than you most likely won't run into any problems since almost all devices already have the current version, it would be rather difficult to find a device that is not up to date. You just have to be careful when you are quickly pushing out an update to your app that uses some new feature that has been introduced just a few days ago. In that case you might run into more problems.

But in the end you have to remember that this all depends on the country you release your app in and on the ecosystems you want to release your app for.

I hope I could answer your question and if you have any further questions feel free to ask!

like image 159
Xaver Kapeller Avatar answered Oct 07 '22 22:10

Xaver Kapeller


I use Analytics and Admob for my app, and they both work with devices that don't have Google play services installed

Analytics: link here

Note: The SDK can be used and will work on devices that do not have Google Play Services. In this case the SDK will will automatically fall back to local dispatching.

Admob: see this question on SO. I have also read in a Google Group discussion about this topic and one developer in the Admob team has confirmed that it will work but now I can't find the link.

For other Google Play Services libraries, I don't use them so I cannot confirm about them

like image 35
Hải Phong Avatar answered Oct 07 '22 22:10

Hải Phong