GooglePlayServicesUtil.getErrorDialog is null

后端 未结 4 1356
失恋的感觉
失恋的感觉 2020-12-05 06:27

I\'m using ACRA (arca.ch) to generate automatic error reports.

I just released a new version of my app using Google Maps Android API v2. I\'m getting an error repor

4条回答
  •  無奈伤痛
    2020-12-05 07:09

    An update of the answer by @Nevermore, since GooglePlayServicesUtil methods are deprecated in favour of GoogleApiAvailability:

    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(activity.getApplicationContext());
    if (resultCode == ConnectionResult.SUCCESS) {
        activity.selectMap();
    } else if (resultCode == ConnectionResult.SERVICE_MISSING ||
               resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED ||
               resultCode == ConnectionResult.SERVICE_DISABLED) {
        Dialog dialog = googleApiAvailability.getErrorDialog(activity, resultCode, 1);
        dialog.show();
    }
    

    Note the order of the first two parameters in getErrorDialog() has been switched around in the GoogleApiAvailability implementation.

提交回复
热议问题