Ensure Google Play Services APK is updated

If your app is using any Google API in your project, then you need to make sure that your device has Google Play Services APK updated.

Firstly, you have to decide the accurate position where you need to insert the code to update Google Play Services.

If your app is entirely based on Google Play Services, then you can do this at the time your app launches initially. However, if only a part of your app uses Google Play Services, then you should do it whenever user needs to access that part of your app.

Now there are two ways to check availability of Google Play Services :

  1. Using GooglePlayServicesUtil

But the problem with this approach is that some methods and fields of GooglePlayServicesUtil have been deprecated.

So, the second and better approach (which google also recommends) is

2. Using GoogleApiAvailability

This will show you a Dialog containing an appropriate message about the error occured and the required action that will take you to play store to install or update Google Play Services.

Finally, your device will have Google Play Services up-to-date!!

One thought on “Ensure Google Play Services APK is updated

Leave a Reply