GooglePlayServicesUtil.getErrorDialog is null

后端 未结 4 1364
失恋的感觉
失恋的感觉 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:24

    Google suggests (also in docs) calling getErrorDialog() if the result code is SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED or SERVICE_DISABLED. So it may be that the last possible status code (SERVICE_INVALID) is what's causing trouble.

    I'm using the following code and so far it seems to work ok (testing in emulator, platform 2.3.3):

    int resultCode = GooglePlayServicesUtil.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 = GooglePlayServicesUtil.getErrorDialog(resultCode, activity, 1);
        dialog.show();
    }
    

提交回复
热议问题