Question: In my application, I need to check Google Play services version (which is installed in user's device). Is it possible ? And if yes, how can I do that?

Answer: 
Here is my solution:

```
private boolean checkGooglePlayServices() {
        final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
        if (status != ConnectionResult.SUCCESS) {
            Log.e(TAG, GooglePlayServicesUtil.getErrorString(status));

            // ask user to update google play services.
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 1);
            dialog.show();
            return false;
        } else {
            Log.i(TAG, GooglePlayServicesUtil.getErrorString(status));
            // google play services is updated. 
            //your code goes here...
            return true;
        }
    }

```

and you have two options, either write your code directly in else block as commented, or use the returned boolean value for this method to write custom code.
From newer updates i have ended up with this code, i have made a handy method to manage all stuff related to it..

All details related to availability of Service and related details are available [here](https://developers.google.com/android/reference/com/google/android/gms/common/GoogleApiAvailability#isGooglePlayServicesAvailable).

```
 private void checkPlayService(int PLAY_SERVICE_STATUS)
    {
        switch (PLAY_SERVICE_STATUS)
        {
            case ConnectionResult.API_UNAVAILABLE:
                //API is not available
                break;
            case ConnectionResult.NETWORK_ERROR:
                //Network error while connection 
                break;
            case ConnectionResult.RESTRICTED_PROFILE:
                //Profile is restricted by google so can not be used for play services
                break;
            case ConnectionResult.SERVICE_MISSING:
                //service is missing
                break;
            case ConnectionResult.SIGN_IN_REQUIRED:
                //service available but user not signed in
                break;
            case ConnectionResult.SUCCESS:
                break;
        }
    }

```

I use it like this,

```
GoogleApiAvailability avail;
 int PLAY_SERVICE_STATUS = avail.isGooglePlayServicesAvailable(this);
 checkPlayService(PLAY_SERVICE_STATUS);

```

And for version `GoogleApiAvailability.GOOGLE_PLAY_SERVICES_VERSION_CODE;` will give you.

And one of the most useful answer i found during my research [is here.](https://stackoverflow.com/questions/31016722/googleplayservicesutil-vs-googleapiavailability)