I am trying to create a simple Google authentication example, but the login success callback is not triggered. Here is what I have done:
Added build hint android.playService.auth, android.playService.auth both set to true.
Created a developer certificate for android, and pasted SHA1 into Google Developer console Android client
In the Google developer console, enable Google Plus API.
Then I pasted the example code from here https://www.codenameone.com/google-login.html
But on the device, the successful login callback is not triggered after the first doLogin() call, only after the second.
Note that following similar steps I was able to configure Facebook auth and everything went fine. I am not sure what I am doing wrong here though.
How do I configure Google Authentication in Codename One?
This seems to be a regression with the migration to API level 23 and the new Android permissions system the current workaround is to revert to API level 21 but that poses a problem with apps already submitted to Google with level 23.
I've filed this issue to track the fix that should work for newer API levels.
Related
I ran into such a problem, when I tried to initialize firebase and get the FCM token, I get this error, who faced it? What could be the reason? A month ago, everything worked, after that nothing was changed in google-services.json file, firebase flow in project, or in google console.
API key permissions added
In our case, this happened when we added a new Firebase library to our project (Performance Monitoring). Our API key is restricted to only allow certain APIs to work, as suggested by Google.
Log in to the Google Cloud Console, and make sure you're allowing the API to work with your restricted key. In this specific case, you need to allow the Firebase Installations API.
Once I added that and waited about 10 minutes, this error stopped and the Firebase tools are working as expected with our app.
I fixed same error while adding push notifications into iOS project:
Fixed on Google Cloud console -> APIs & Services -> Credentials
then CLICK on the API Key you are using for the app having problems
Scroll to the API restrictions section
expand the combo box and select Firebase Cloud Messaging API and Firebase Installations API hit OK after selecting both and SAVE this.
REMEMBER: Wait 5 to 10 minutes to test this working, so be patient and grab a coffee before testing again :)
The problem was on key, idk why, but when I set new key, all ok.
20.05.2022 Better to use Android apps restrictions now.
I was using google map API in my app was working fine but yesterday when I added some other feature in the app and started testing it suddenly Map API is no longer working so I thought there may be some issue with the code so I checked and found that I have not changed anything in the map API but when I try to create another app in the Google API came to know that limit is crossed and not even able to see what are the current project I have as the limit is 30 as it says but, in reality, I have used mostly 4-6 app using the API . I looked into other similar questions and tried the same thing but no solution so far. Any solution that may help me will be helpful
I am getting this error while running
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
the key is there and As i said it was the same app which was working earlier.
Following steps might help:-
1. Login to google devloper console.
2. Select your project
3. Select "Library".
4. Check Maps API if it is enabled or not.
1 => https://console.developers.google.com/apis/credentials
2 => create credentials
3 => Api key
4 => Restrick Key
5 => Application restrictions -> Android apps and API restrictions -> Don't restrict key
6 => Save then wait for 5 min then use generated api key
Here is the story. I had integrated Google Drive Android SDK (8.1.0) into my app (AnyCopy) around three years ago. And I followed the tutorial to set up properly including adding credentials and api key. Everything worked okay. I could backup and restore my data without any problem. Even today it works okay if I download it from Google Play.
Recently I have been trying to refactor AnyCopy and integrate the newest Google Drive Android SDK (Google Play Service Version number 12.0.1 )into my app and experiencing a strange error with message
java.util.concurrent.ExecutionException:
com.google.android.gms.common.api.ApiException: 17: API:
Drive.API_CONNECTIONLESS is not available on this device.
at com.google.android.gms.tasks.Tasks.zzc(Unknown Source)
at com.google.android.gms.tasks.Tasks.await(Unknown Source)
However, if I create a new credential on Google Console with a different signing key. And the problem is resolved. I realize that the problem rooted from the credential configuration. However, I could not figure out how to resolve it as it might be a Google Drive SDK backwards compatibility bug. Anyone else has ever run into this issue? Any suggestion will he highly appreciated.
I had the same error. I created a new project and got the credentials for the google API but forgot to enable the Google Drive API. Going to the dashboard and enabling the google drive API did the trick.
Hope that helps.
The new API you are using still got the instances and the folders of the older version. You just can check by switching from Android to your project and external libraries. If there is the presence of the older version of that api, try refractor and clean the project and Rebuild it. Hope it suits your concern. Surely a backward compatibility issue.
What has happened in my case was that I was setting an authorization scope different from the scopes that the DriveClient object supported that is only drives.file and drive.appfolder as you see here:
Note: The Google Drive Android API currently only supports drive.file
and drive.appfolder authorization scopes. If your application requires
additional permissions or features not yet available in the Drive
Android API, you must use the Google APIs Java Client.
In my case, I was trying to use the full drive access and the error wasn't really related to the connection type. I found it by looking at the CommonStatusCodes class.
To solve that I just removed all other scopes and left only the drives.file.
You may, or may not :D, need to revoke the access and log out the users from your app and re-login and request access to their google drive again.
If you're using firebase your code will look a bit like that:
AuthUI.IdpConfig.GoogleBuilder()
.setScopes(Arrays.asList(Scopes.DRIVE_FILE))
.build()
But if you're using only straight the GoogleSignInClient it would look like that:
GoogleSignInOptions signInOptions =
new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestScopes(Drive.SCOPE_FILE)
.build();
GoogleSignIn.getClient(this, signInOptions)
If you need more than just access to files and appfolder you won't be able to use the DriveClient class and, according to their docs, will need to Connecting and Authorizing with the Google APIs Java Client.
I really hope that helps you, I've lost some hours until notice that, unfortunately.
Thanks,
I'm trying to access the Google Drive API in my app using the guide at REST API Quickstart, however when I run the app I get a 403 forbidden error message that tells me that the Drive API is not enabled for my project.
I don't understand why this is or how to fix it. The Drive API is definitely enabled in the Google Developer's Console and is set up as with OAuth 2.0 credentials, along with any other API's that I thought might be related. The full error screen grab is shown in the link:
If you used a different package name than the one in the example, then you might have forgotten to change it in the codes...like make sure you have the package name correctly set in the build.module, manifest...it happens when you just copy and paste stuff...
Check google developers console make sure drive SDK and drive API are enabled.
They both need to be enabled for some of the requests.
This question is the same as this Google+ Platform for Android - getCurrentPerson but i didn't find the solution here.
Here's the problem:
plusClient.getCurrentPerson() always returns null from onSignedIn(PlusClient plusClient) function
I used the PlusSampleActivity -> SignInActivity from Google Play Services.
Is this a bug, or anyone here knows how to fix this?
Have you setup a client ID for your application in the API console (https://code.google.com/apis/console)? When your app connects, its key fingerprint and packagename are used to look up a project from the console and check whether you have the Google+ API enabled, and enough quota to handle the request. If its not found, it looks like you have 0 quota so the request fails, which will give you null.
You can see the steps to follow here: https://developers.google.com/+/mobile/android/getting-started#step_1_enable_the_google_api
As was answered by Ian, you must setup your app hash key in the API console. But beware that after performing this setup it may take some time (sometimes few hours) before you can use it, so be patient.