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:

  1. the googleapiclient class, provides example using drive api (.addapi(drive.api)), there no googlecloudmessaging.api can find, that's not going work.
  2. "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

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -