I am trying to use GCM for asynchronous communication between my application and a tiny Java backend server running on my personal computer. My problem is that I cannot understand the stitched and conflicting help pages for GCM and Google Play services. I would like to use one of the old answers to this question, but the API and documentation have been redesigned in the last couple of months, and all such questions that I find relate to last year or older.
The Google Play Services Tuning Guide says to ensure you have the required APIs with:
- The GoogleApiClient class, which provides an example of using the driveβs API (
.addApi(Drive.API) ), but there is no GoogleCloudMessaging.API that I can find so that it does not work. - "Another approach is to use the isGooglePlayServicesAvailable () method." This is due to the GooglePlayServicesUtil class, but almost every method of this class is deprecated in favor of the non-static version of GoogleApiAvailability, and I, for obvious reasons, would like to avoid using outdated code wherever possible. The GoogleApiAvailability class will also not allow me to instantiate.
So my questions are: how can I make sure that the updated version of Google Play Services is installed on my device? And is there a way to check if the GCM API is available before using it (or do I even need to do this if Google Play Services is updated)?
Additional Information:
Min SDK 14
Target SDK 22
Sorry for not contacting some documents, give a link to the reputation link.
source share