I was implementing google sign but i came to this method and this is deprecated show its always return null value
String token = GoogleAuthUtil.getToken(loginActivity, accountName, scopes);
even i used other methods
String token = GoogleAuthUtil.getToken(loginActivity, accountName, scopes, null);
but it still returns null and shows as it is deprecated. Please help how can i get access token
In the below getToken
method, I think you are passing accountName
which is a string value.
String token = GoogleAuthUtil.getToken(loginActivity, accountName, scopes);
String token = GoogleAuthUtil.getToken(loginActivity, accountName, scopes, null);
thus it will still return deprecated method getToken
.
converting string into account before passing as mentioned below will help`:
Account accountDetails = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
String token = GoogleAuthUtil.getToken(loginActivity, accountDetails, scopes);
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With