2

Есть ли способ убедиться, что на устройстве установлены последние службы Google? а если не показывать карты в приложении и не иметь сбой приложения?Android google maps v2

ответ

1

Надеется, что это помогает

public boolean isGoogleMapsInstalled() 
{ 
    try 
    { 
     ApplicationInfo info = getPackageManager().getApplicationInfo("com.google.android.apps.maps", 0); 
     return true; 
    } 
    catch(PackageManager.NameNotFoundException e) 
    { 
     return false; 
    } 
} 
1

Вы можете позвонить:

int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(); 

if(code == ConnectionResult.SUCCESS) { 
    // google play services are up to date 
} else { 
    // get dialog to fix issue 
    Dialog dialog = GooglePlayServicesUtil.getErrorDialog(code, this, REQUEST_GPS_ERROR_DIALOG); 
} 
1

Попробуйте этот путь

private boolean checkPlayServices() { 
     int resultCode = GooglePlayServicesUtil 
       .isGooglePlayServicesAvailable(this); 
     if (resultCode != ConnectionResult.SUCCESS) { 
      return false; 
     }else{ 
        GooglePlayServicesUtil.getErrorDialog(resultCode, this, 
        9000).show(); 
      } 
     return true; 
    } 
Смежные вопросы