Hey everyone,
I'm trying to capture my AccessToken from a request to Google for access to
Google Calendar.
I can get all the way through the process right to where it gives the
accesstoken but since it's in the browser I can't seem to grab it.
I've previously done this with a custom scheme (Fitbit allows the use of
custom Schemes with their OAuth 2) but I guess I can't do the same with
Google?
I made a small easy plugin like I did for the Fitbit OAuth 2 for this
project with Google and have had no luck at all. I know the plugin is
firing because I put
Toasts in the methods like onCreate etc.
public class MainActivity extends UnityPlayerActivity {
@Override
protected void onCreate(Bundle savedInstance)
{
super.onCreate(savedInstance);
Intent gameIntent = new
Intent(this,com.unity3d.player.UnityPlayerActivity.class);
if(com.unity3d.player.UnityPlayer.currentActivity == null)
{
startActivity(gameIntent);
}
Context context = getApplicationContext();
CharSequence text = "End of OnCreate";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
@Override
protected void onNewIntent(Intent intent)
{
Context context = getApplicationContext();
CharSequence text = "On New Intent";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
super.onNewIntent(intent);
handleAccessToken(intent);
}
private void handleAccessToken(Intent intent)
{
Uri uri = intent.getData();
Context context = getApplicationContext();
CharSequence text = "handleAccessToken";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
Log.d("Unity", "About to Message Unity with Return code: " +
uri.toString());
UnityPlayer.UnitySendMessage("CustomAndroidPlugin", "PassGoogleReturnCode",
uri.toString());
}
}
This is the small plugin and it should work without issue (as it works
perfectly fine with my other app, only difference is the package names,
which I made line up with my current one)
I get the Oncreate Toast but none of the others.
Is there anyway to get Google OAuth 2 to redirect to my app?
Thanks for any help or insight.
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/f94750e9-cdf2-4fd9-8e5e-b301fc346552%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.