android - How do I check for Google Play Services API availability? (specifically the GCM API) -
i trying use gcm async communication between app , tiny backend java server running on personal computer. problem can't figure out cross-linked , contradictory reference pages gcm , google play services. love use 1 of old answers question, api , documentation got reworked in last couple months , similar questions find last year or older.
google's guide setting google play services says ensure required apis present using either:
- the googleapiclient class, provides example using drive api (
.addapi(drive.api)), there nogooglecloudmessaging.apican find, that's not going work. - "another approach use isgoogleplayservicesavailable() method." links googleplayservicesutil class, every method in class deprecated in favor of googleapiavailability's non-static version, , understandably avoid using deprecated code wherever possible. googleapiavailability class won't let me instantiate it.
so questions these: how can ensure device has updated version of google play services? , there way check whether gcm api available before use (or need if google play services updated)?
additional info:
min sdk 14
target sdk 22
apologies not linking of docs, darn reputation link limits.
thanks daniel nugent pointing out had missed existence of googleapiavailability.getinstance()!
Comments
Post a Comment