Add Multiple Google account in Android App - android

Currently, i am able to add single account using Google Plus Api provided by Google in Android App.
Q: I want to support multiple google Account, get back multiple access token for all the accounts ? App need is that it has to be implemented using Google Api provided by Android. Implementing using Web-view is not recommended.
Solution Tried: disconnecting current and getting the new Account, but unfortunately it revoke the access of old Account.
Please guide me a way, thanks in advance..

Related

Can google sign be used just to log in?

I'm going to implement Google Sign in my app to let the users log in with their google account. This app doesn't allow registration, as the users are created in a web portal.
The web also have google sign, except that it does uses it for registration.
So, what I want is to only use this in the android app to log users who has already registered at the portal. Is that possible?
I'm following the android docs, which says I need to configure a Google Api console project, do I need two (one for the android app and the other for the web), or it can be managed with just one? Also, I'm wondering the same question having two apps (android and iOS).
I'm trying to understand the logic of the process. Google docs explain how to do it, but I wanted to know a little more about what's happening.
If I understand your question correctly then you need to implement the google authentication process in your application that can be used in all the platforms (Web, iOS, Android).
Google has a platform Firebase Authentication solely for this purpose.
https://firebase.google.com/products/auth/
Here you create a project in the firebase console and then use it for all the 3 platforms.
You can go through the google documentation, it is easy to understand and use.
Or you can go through this link to understand how to implement it on Android.
https://medium.com/#valokafor/working-with-firebase-authentication-8f7dcb016e84

Google authentication with email and password.

I am creating an application that uses google drive api, and requires authentication of a google account. The example on the quick start for using drive api for android uses google sign_in where user would be required to choose an account from the google accounts already added on the phone.
I dont want user to choose there own account. I want to add the account the api would be used in from code, such that files would be accessed from my own specified accounr not that of the user of the app. But I cant seam to find any sign_in or authentication form apart from the case when user is to choose an account.
Please can this be done? And if so how?
Answer would be simple No, you can do that but you have to use different API than that of Google's one. Google will ask to choose from account as it is added in implicit intent.

Making changes to Google+ SignIn using API

I am using Google Android API for integrating Google SignIn in my app. I am able to login successfully, but the API prompts dialog to choose an account even if one account is registered with the account manager.
I want to how we can change this. I have seen this things being implemented in many apps in App Store but I am not able to figure out how to do it.

how to deal with Adsense API - Android

I want to make an App to read my earning on Adsense.
I made an app on Google and I generated a URL to login into the App.
https://accounts.google.com/o/oauth2/auth?from_login=0&response_type=code&scope=https://www.googleapis.com/auth/adsense&redirect_uri=xxxxxxxx&access_type=offline&as=-415b671ff3966dc2&pli=1&client_id=xxxxxxxxxxx&authuser=0&hl=en
but when the user login into the App and click on "Allow" the output has no access token just has "code".
also I want to know if there is an example of using google OAuth api on android because I tried to use it but I failed.
There's an AdSense Management API sample for Android in:
https://github.com/googleads/googleads-adsense-examples/tree/master/android
It uses Google Play Services to get the list of accounts on the device and the Google Client Library for Java to make the requests.
Yes, before calling any Google's API you need to be OAuth authenticated first, and thus to have a valid token.
Check this out to know how:
http://developer.android.com/training/id-auth/authenticate.html

Can I use AccountManager to let users sign in with their Google account?

I'm creating an app that will need users to create an account. (Like Facebook or Twitter would require you to.)
BUT, since it's an Android app, should/can I let them sign in with their Google Account using AccountManager or some other service? It'd be very helpful if they could just sign in to their Google account and their settings and other options would be saved to that account.
Main questions summed up:
Is it possible to let a user just use their Google account in my app?
If so, do I use AccountManager to have them sign in and save account information/settings?
What are other options?
Yes, you can get users to log into their Google Services using their Google credentials, for example, I have an app on Google Tasks and I use the Android AccountManager to let users authenticate themselves using their Google account on the android device (No need for users to enter their password!)
There are some really good examples to get you started:
This is an in-depth look into how you can authenticate based on the users Android credentials, has an example of how things work and how the UI should be: http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2
This is an example of getting AccountManager to work with a Google service like Google Tasks: https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android
The last example is using the same concept for accessing the Google Picasa service: http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager
The other options you have is to have users manually enter their username/password. For that you have to use a third party authentication API (like signpost for OAuth) for them to log in.
In my tasks/todo application I provide users both options to sign in, using their android credentials or using third party authentication for users that want to log in using some other account (an account which is not enabled on that device)
Let me know if you have more questions
Although it is a new development, Google Plus Sign-in introduced as part of Google Play Services can also be used. More info can be found at Android developers blog. See example implementation from Banjo app
There seems to be a big limitation - The user need to have Google+ app installed on the device to use this.
Also this is a pretty good blog if someone is interested in implementing the solution.
#Soham gave you some very useful links but he didn't correct one major error: AccountManager is the entity that manages the accounts on your Android device - it has nothing to do with your google account! you can use google account and create a NEW account on your device using the AccountManager.
The rest you can learn from the links Soham gave you.

Categories

Resources