I\'ve seen this Q&A LocationSettingsRequest dialog - onActivityResult() skipped. It isn\'t the same issue because everything is being done in an Activity already.
Th
If anyone has stumbled on to this problem, gianlucaparadise's answer is one of the better way's of solving this problem. Although the answer is deleted, it adds a lot of value.
In my case there was this error: I've used
public abstract class AGoogleDriveBase extends ABase implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
//...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//...
and this function not called using
try {
result.startResolutionForResult(this, REQUEST_CODE_RESOLUTION);
} catch (SendIntentException e) {
Log.e(TAG, "Exception while starting resolution activity", e);
}
because when I used a main activity
public class myAct extends AGoogleDriveBase implements ... {
//...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
the super method not called (not existed this string):
super.onActivityResult(requestCode, resultCode, data);
You can check out the Google Play Location Sample since your code is quite similar it.
From what I can tell on your samples, onResult() may not be called because the case is not LocationSettingsStatusCodes.RESOLUTION_REQUIRED
. Its not calling the startResolutionForResult
or an underlying setActivityForResult
inside it.
If you are running this code in Fragment than don't use startResolutionForResult(). Instead use
startIntentSenderForResult(status.getResolution().getIntentSender(), REQUEST_CODE_LOCATION_SETTING, null, 0, 0, 0, null);
and overrider onaActivityResult() in your fragment. Result will be delivered to this method only.
Well I feel silly. My Activity had noHistory="true"
in the Manifest so when the other Activity was started there was nothing to come back to.