Google Play Services v7.8 Nearby API AUTH_API_ACCESS_FORBIDDEN - android

Has anyone gotten the Google Play Services v7.8 Nearby API to work? I’m getting the status error below when I try to subscribe for messages. I've enabled the API and configured the key, etc. in the Developer Console as described here.
Status{statusCode=AUTH_API_ACCESS_FORBIDDEN, resolution=null}

I tried the newest NearBy API demo and succeed.
You can just go here and clone it. Open it in Android Studio, and follow the following steps:
Create a project on Google Developer Console. Or, use an existing
project.
Click on APIs & auth -> APIs, and enable Nearby Messages API.
Click on Credentials, then click on Create new key, and pick Android
key. Then register your Android app's SHA1 certificate fingerprint
and package name for your app. Use
com.google.android.gms.nearby.messages.samples.nearbydevices for the
package name.
You can get SHA1 by using: keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v and the password by default is android.
Copy the API key generated, and paste it in AndroidManifest.xml.

Not sure whether to make it as an answer.
But I scratched my head for 5 hours and figure out the issue.
I've more than 5 projects on my google API console.
Everything was perfect for the sample project.
But with actual project, I forgot to enable API :(

Related

Google Game Services - Signing certificate fingerprint (SHA1). Debug keystore is always invalid [duplicate]

I have generated my SHA1 code from my keystore but when I try to create an OAuth client 2.0, Google game console is giving me the error: "Certificate fingerprint is invalid".
Anyone knows why this happens?
How do I fix this?
I've contacted Google Play Developer Support about this issue (I've got a same problem).
Here is their answer : Please ensure the key is set to 2048 bit and is valid for at least 25 years.
I've tried it, but sadly my debug.keystore is still not getting accepted, maybe there will be some luck on your side.
$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
I'm Dan, and I'm a software engineer on Play Games Services.
First, let me thank you for using our service, and apologize for the inconvenience caused. We have discovered a bug in our product that prevents users from linking fingerprints of their signing keys to newly created applications. The issue has been fixed and you should be able to link your application as expected.
If you encounter a bug in the feature, please let us know using the bug report tool (Help -> Need more help? -> Send feedback & report bugs).
I ran into this issue recently.
After I added an Android credential, the Google Play Console pops up a modal with the app name and an SHA-1 fingerprint. For some reason this fingerprint is incorrect.
In the Google Play Console You need to go to Release -> App Integrity,and copy the SHA-1 certificate fingerprint under App signing key certificate.
Ok that is weird. I encountered the same problem. while I have done this numerous time in the past, never had this issue before. I tried with multiple options but still no go. So figured out a workaround. Thought of sharing it to save time:
Once you create a Game Service, You will get the API console project under -> Game Details > Api Console Project
Click your API project, and it should take you to your API console project.
Create Auth SHA1 keys by choosing credentials > create credentials.
Now, Google site do suggest not to do it
Warning: Do not create new client IDs for your game from the Google API Console. If you do so, Google Play games services will not associate your game settings with the client ID, and this could cause errors during gameplay.
https://developers.google.com/games/services/console/enabling
But as far I Have only one Sha1 for this package, I think we are good. I can confirm that my project is working fine and I am able to successfully linked the app. Although, I have still not tested all my games features.
Also, I am still figuring out the reason on why it works from Google API console with the same Sha1 key and package and will not work if I use the same combination from Play console -> linked apps. I will update on this thread as I learn more. Perhaps Google is changing the OAuth screen consent screen, may be this is a new change now.

google map not show in release apk using android studio

I am developing an app, here I'm using google map in debug mode map shows correctly but in release mode map not showing and shows only current location.
By using google map API I have tried but still its not working and also I find the SHA1 by using keystore(i.e. keytool -list -v -keystore file path.jks) then also its not working.
By using following views I tried and found the SHA1 key but map not shown in app.
Release APK file not showing google maps
How do i do?
Have you set your google_maps_key in both debug & release folder in google_maps_api.xml.
If not please, set it. You can find both folders inside Project structure.
See image for reference.
Generate API key access using release key-store. And set Google API console.
Go to google API console.
crate new project
generage API key
enable your service
add API key in your project
OR
You can simply follow this developer guide LINK.
If you have troubling in getting SHA-1 key. You can easily get it by running Signing-report gradle task as below picture (in Android studio).
I solved it by looking at Google Play Console in the left menu select configuration, then integrity of the app and then copy the sha1 of the upload key certificate that is below of the SHA1 Certificate of the app signing key and add it in the same API key of Google Cloud Platform. This way I didn't have to make changes to the apk.
If it doesn't work for you, add both and try.

Using Google Play Services on different computers (VCS)

I'm programming an android app an added Google Play Services for Google Sign-In support. Therefore I generated and downloaded my configuration file from Google's developer console. I integrated the file into the app folder and everything works fine while sign in with google in my app so far.
Now I wanted to share my Project with another colaborator, but when she pulled the code from GitHub, she cannot sign in successfully. When she tries to sign-in the GoogleSignInResult-object has the following status: Status{statusCode=DEVELOPER_ERROR, resolution=null}. As I looked up in the internet it is probably an issue with the configuration file and the correspondig SHA1-key, but I didn't find a solution.
Does anybody know how to solve thies issue?
DEVELOPER_ERROR
The developer has configured something incorrectly with their
application. This is a hard error, since retrying will not fix this.
Maybe the issue is Google Play services was unable to find a matching client from the console based on the SHA1 and package name.
You can follow this guidelines on how to troubleshoot the problem about SHA1.
The certificate with which you are signing your game should match the certificate fingerprint associated to your client ID. To verify this, first check your certificate's SHA1 fingerprint:
Find your certificate file and obtain its SHA1 fingerprint. To obtain the SHA1 fingerprint, run this command:
keytool -exportcert -alias your-key-name -keystore /path/to/your/keystore/file -list -v
Take note of the sequence of hexadecimal digits labeled SHA1: in the output. That is your certificate's fingerprint.
Note: If you are using a debug certificate, replace your-key-name with
androiddebugkey in the command above. If using a release certificate,
use the name you chose for your key when creating the certificate.
For more information and the next step, just check the link in the guidelines above.
Also check this SO question, it might help you also to solve your problem.

Android API Key for Android Map

I'm Working on Android Map.When i want to generate the API key V2 .There is no option like this to enable API key v2.You can see this
Please guide me to put map in my application.please ignore mistakes in question.
Generate an api key by going through credentials tab.
There google will ask your application package name and SHA1 finger print key.
You must create a project in google dev console. After that generate a sha1 key and put the key in this project. Here see official documentation. https://developers.google.com/maps/documentation/android-api/signup#if-you-are-using-the-standard-google-maps-android-api
Refer this image.Click on "Google Maps Android API" then click on "Enable".
When you create a map activity in android studio.there is a file called google_maps_api.xml in that file there is a link to gerenerate and enable API.So that put that link on your browser and get the key. and paste it in google_maps_api.xml at required space..
By doing this you will get apiv2 access
You have to create a project on developer console dashboard.
Then you need a sha1 key for this -
Run the following command on cmd to get your sha1: keytool -v -list -keystore "<debug.keystore path> and press “enter” when a password asked.
Then copy and keep SHA1 for later use. For my case it is (3C:64:03:7B:0E:F7:E5:71:0D:10:9D:62:4C:03:8C:F2:4E:AD:B8:94)
- Get the key for android apps.
You need to have a gmail account.
Create Google APIs project from https://code.google.com/apis/console address.
From services, Turn “Google Maps Android API v2” to ON.
From API Access, create new Android Key.
Paste SHA1 and your package name <SHA1>;<package name> for example at my case it is (3C:64:03:7B:0E:F7:E5:71:0D:10:9D:62:4C:03:8C:F2:4E:AD:B8:94;info.tekguc.umut.googlemapsmapsandroidv2)
Copy generated API for later use, for my case it is AIzaSyDciL7-T3BphxGv2q-A77vNrcyJQ_sTrgI
for more detail go through with this doc. link

Android Google Maps API v2: Authorization failure at different laptops

I've followed the steps here and here to create a MapView in our teams project which we sync with svn. After following the steps, MapView was running smooth, but only on my laptop. My project members are always getting
02-06 13:27:37.327: E/Google Maps Android API(19490): Authorization failure.
when opening the MapView. So I deleted the old one and generated a new SHA1 fingerprint for a new Google API Key on another laptop with my Google Account with:
keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android -v
So now it's working on the other laptop where I generated the SHA1 fingerprint but when I try to run the project on my laptop I'm now getting the
02-06 13:29:51.280: E/Google Maps Android API(20262): Authorization failure.
Error.
We are not using proguard-project.txt, we tried different devices where google-play-services is installed and included /extras/google/google_play_services/libproject/google-play-services_lib as a library. We also tried to generate multiple API Keys but only one was working.
What are we doing wrong? Do we have to use different Google Accounts to create individual keys?
Quoting the Google API Console:
API requests are sent directly to Google from your clients' Android
devices. Google verifies that each request originates from an Android
application that matches one of the certificate SHA1 fingerprints and
package names listed below. You can discover the SHA1 fingerprint of
your developer certificate using the following command[...]
One SHA1 certificate fingerprint and package name (separated by a semicolon)
per line.
Highlight here on one per line.
`
For each laptop where you build your app you have to generate an SHA1 fingerprint and add it in the API Console.
You have two options here.
Add a separate line to the api key for each device you have.
Extract the api key to a file (eg. map_key.xml) and reference this file from the AndroidManifest.xml.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_api_key_v2" />
Add this file to your .gitignore - so now each project member can override with its own key.

Categories

Resources