I am trying to handle use cases where the user doesn't have Play set up correctly. It seems extremely straight forward, but I can't get the dialog to do anything. I have the following code in onCreate
for a FragmentActivity
that uses Maps v2
. I have ensured that execution does go inside the if statements.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
this.helper = (DatabaseHelper) OpenHelperManager.getHelper(this, DatabaseHelper.class);
int googlePlayStatus = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if(googlePlayStatus != ConnectionResult.SUCCESS) {
if(GooglePlayServicesUtil.isUserRecoverableError(googlePlayStatus)) {
GooglePlayServicesUtil.getErrorDialog(googlePlayStatus, this, googlePlayStatus).show();
}
}
//... do some stuff, such as use CameraUpdateFactory which throws NPE.
}
I have tried inserting the code into another activity, without the if checks, and the dialog shows just fine.