void resolveConnectionResult() {
// Try to resolve the problem
if (bNuke) {
return;
}
Log.d(TAG, "resolveConnectionResult: trying to resolve result: " + mConnectionResult);
if (mConnectionResult.hasResolution()) {
// This problem can be fixed. So let's try to fix it.
Log.d(TAG, "result has resolution. Starting it.");
int requestCode;
// Toast.makeText(mBA.context, "Before ion", Toast.LENGTH_SHORT).show();
ion = new IOnActivityResult() {
@Override
public void ResultArrived(int resultCode, Intent intent) {
Log.d(TAG, "Result Arrived");
if (resultCode == Activity.RESULT_OK) {
Log.d(TAG, "inside ok");
connectCurrentClient();
}else {
Log.d(TAG, "inside else");
bNuke = true;
giveUp();
}
}
};
BA pBa = mBA.processBA;
try {
pBa .startActivityForResult(ion, null); //<-- passing null instead of an intent
} catch (NullPointerException npe) {
//required...
}
BA.SharedProcessBA sba = pBa.sharedProcessBA;
try {
Field f = BA.SharedProcessBA.class.getDeclaredField("onActivityResultCode");
f.setAccessible(true);
requestCode = f.getInt(sba) - 1;
//requestCode holds the value that should be used to send the intent.
//Toast.makeText(mBA.context, Integer.toString(requestCode), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
throw new RuntimeException(e);
}
try {
// launch appropriate UI flow (which might, for example, be the
// sign-in flow)
Log.d(TAG, "Starting for result");
mExpectingActivityResult = true;
mConnectionResult.startResolutionForResult(mBA.activity, requestCode);
} catch (SendIntentException e) {
// Try connecting again
Log.d(TAG, "SendIntentException.");
connectCurrentClient();
}
} else {
// It's not a problem what we can solve, so give up and show an
// error.
Log.d(TAG, "resolveConnectionResult: result has no resolution. Giving up.");
giveUp();
}
}