when I'm trying to follow the example on how to check if Google Play Services is installed I receive the following error: "connectionResult cannot be resolved" in the line inside servicesConnected method
int errorCode = connectionResult.getErrorCode();
What can be missing? I'm copying and pasting it. I'm following the example here
Thanks!
It's a bug in the example. Use this instead:
} else {
// Get the error code
// Get the error dialog from Google Play services
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
resultCode,
this,
CONNECTION_FAILURE_RESOLUTION_REQUEST);
the solution to where it said there was a missing return was to add return false at the end of the else so example:
else { // Get the error code
// Get the error dialog from Google Play services
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
resultCode,
this,
CONNECTION_FAILURE_RESOLUTION_REQUEST);
// If Google Play services can provide an error dialog
if (errorDialog != null) {
// Create a new DialogFragment for the error dialog
ErrorDialogFragment errorFragment =
new ErrorDialogFragment();
// Set the dialog in the DialogFragment
errorFragment.setDialog(errorDialog);
// Show the error dialog in the DialogFragment
errorFragment.show(getSupportFragmentManager(),
"Location Updates");
}
return false;//THIS NEEDS TO BE FALSE
}
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