I'm following a tutuorial to use google location services. So, I'm trying to get location using Google API service. But I got isGooglePlayServicesAvailable
(this) is deprecated error. Can anyone help. Thanks
Below is my code for checking if Play services exist on device:
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 is not supported", Toast.LENGTH_LONG) .show(); finish(); } return false; } return true; }
Use isGooglePlayServicesAvailable instead
GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
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