I have a project on Google App Engine and an Android project. I need to do login on GAE using Android.
On GAE, I have this code: (redirect user to google login page, it's exactly I want!)
UserService userService = UserServiceFactory.getUserService();
String URL = request.getRequestURI();
if (request.getUserPrincipal() != null) {
// I need to send the MY_GENERATED_TOKEN to my android app
response.getWriter().println(MY_GENERATED_TOKEN);
} else {
response.sendRedirect(userService.createLoginURL(URL));
}
This code is default, and suggested by Google. My problem is that I don't know how access this on my Android app.
I have an Android activity, with a button. I want that when I click on button, open the android browser on Google's login page, I do login, the browser closes automatically and my app receives the token generated by GAE (it isn't a google token, it is a token generated by me).
I don't want to use endpoints.
If you really want to open it with the default browser here is my approach:
But I suggest just use the webview, then you'll have more control:
http://developer.android.com/reference/android/webkit/WebView.html