android - I am trying to check for google play services without using the deprecated method any insight? -


i have been building app requires location awareness , have gotten location awareness work using google play services. issue is, way able find online check if services available deprecated. use input on supposed done now.

here deprecated version:

  private boolean checkplayservices() {     int resultcode = googleplayservicesutil             .isgoogleplayservicesavailable(this);     if (resultcode != connectionresult.success) {         if (googleplayservicesutil.isuserrecoverableerror(resultcode)) {             googleplayservicesutil.geterrordialog(resultcode, this,                     play_services_resolution_request).show();         } else {             toast.maketext(getapplicationcontext(),                     "this device not supported.", toast.length_long)                     .show();             finish();         }         return false;     }     return true; } 

/** method verify google play services on device */ private boolean checkplayservices() {     googleapiavailability googleapi = googleapiavailability.getinstance();     int result = googleapi.isgoogleplayservicesavailable(this);     if (result != connectionresult.success) {         if (googleapi.isuserresolvableerror(result)) {             googleapi.geterrordialog(this, result, play_services_resolution_request)                     .show();         } else {             log.i(tag, "this device not supported.");             finish();         }         return false;     }     return true; } 

note: private final static int play_services_resolution_request = 1000;


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -