I am trying to use GCM to do async communication between my app and a tiny backend Java server running on my personal computer. My problem is I can't figure out the cross-linked and contradictory reference pages for GCM and Google Play Services. I would love to use one of the old answers to this question, but the API and documentation got reworked in the last couple months and all the similar questions I find are from last year or older.
Google's guide for setting up Google Play Services says to ensure the required APIs are present using either:
.addApi(Drive.API)
), but there is no GoogleCloudMessaging.API
that I can find, so that's not going to work.So my questions are these: How can I ensure that a device has an updated version of Google Play Services? And is there a way to check whether the GCM API is available before I use it (or do I even need to do this if Google Play Services is updated)?
Additional info:
Min SDK 14
Target SDK 22
Apologies for not linking to some of the docs, darn reputation link limits.
Thanks to Daniel Nugent for pointing out that I had missed the existence of GoogleApiAvailability.getInstance()
!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With