• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing Google Map using API Key and Certificate

 
AhFai Chan
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I need to display some Google maps, apparently I need to generate an API Key and using this key, generate an SHA-1 certificate fingerprint to attach to the Java package name.

I have several different packages that I need to test. I am running into enormous difficulties generating a 2nd SHA-1 certificate for the 2nd package.

Google support is unreachable without signing up with credit card and I don't quite understand their billing policies for using their APIs. There seems to be a "courtesy limit" after which it is on a "per use" basis. What does that mean? If I release and app which uses the Google API, everytime some uses my app, I have to pay Google?

QUESTION: Using the same API Key, can I generate a second certificate for a different package? Google Developers Console give you that option but it doesn't seem to work for the 2nd certificate.


AT the moment, I can run the fragment, Android Studio throws a lot of errors, but does display the map at the end:
E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
E/GMPM: Scheduler not set. Not logging error/warn.
E/...




 
Tim Moores
Saloon Keeper
Posts: 3336
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Things may have changed since, but when I built the Maps demo app a couple years ago, only the API key was needed, no certificate. Looking at https://developers.google.com/maps/documentation/android-api/start, I don't see any mention of one, either; can you point us to the instructions you're following?
 
Tim Holloway
Bartender
Posts: 18471
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More recently, I think that they did away with the need for an API key at all - at least as long as you made fewer than a set number of map queries per day. I seem to recall ripping out some API key logic from my Google Maps JSF control.
 
AhFai Chan
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:Things may have changed since, but when I built the Maps demo app a couple years ago, only the API key was needed, no certificate. Looking at https://developers.google.com/maps/documentation/android-api/start, I don't see any mention of one, either; can you point us to the instructions you're following?


I think I might have misunderstood Google's intention.

I can create a project ( e.g. "com.androidstudioproject.projname" ) and link it to one API Key with an SHA-1 certificate.

Even though there is an option to create multiple certificates using the same API Key, it doesn't work. Don't bother waiting the recommended 5+ minutes, won't come back to you.

We will need to create a new API Key for each new project (package).


https://developers.google.com/maps/documentation/android-api/config
https://support.google.com/cloud/answer/6158862?hl=en#creating-android-api-keys
https://console.developers.google.com/apis/library?project=sunlit-cab-123623 ( I use Google Maps API )
APICredentialsRGDdemo.JPG
[Thumbnail for APICredentialsRGDdemo.JPG]
API Screen
 
AhFai Chan
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:More recently, I think that they did away with the need for an API key at all - at least as long as you made fewer than a set number of map queries per day. I seem to recall ripping out some API key logic from my Google Maps JSF control.


Dear Tim,

That is very interesting!

Can I get you to rip out the following child in your AndroidManifest.XML and see if it still works?


I got that about the number of free requests per day for which you need an API, if you exceed the number of call requests, you have to pay.
 
Tim Holloway
Bartender
Posts: 18471
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, no. I am using Google Maps on webpages, not in Android.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!