generating google api key in android - android

I am developing an android application which involves google map activity.I have done all the coding part.Now want to generate the google api key for my system.Can anybody help in this regard.Thanks in advance
Tushar Sahni

Everything you need to know is explained in the documentation. Copying from there:
Run this command to generate a certificate:
$ keytool -list -alias alias_name -keystore my-release-key.keystore
(Rename alias_name and my-release-key.keystore to something meaningful)
The result from the above command will be something like this:
Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98
Then go to http://code.google. com/android/maps-api-signup.html and follow the instructions to register your certificate.

Related

When I deploy my xamarin forms app inside my project I see the map, but when I put it up on google play the map is not loading

Followed some guides but I cannot get it quite right. I will show you the process below that does not make it quite work.
First of all I started off by acquiring an API-key on google console and i put that into my project.
I acquired the sha 1 by typing this into the terminal:
keytool -list -v -keystore ~/.local/share/Xamarin/Mono\ for\ Android/debug.keystore -alias androiddebugkey -storepass android -keypass android
The map now runs smoothly and fine in my xamarin project when I run it on my device.
Then when I try to upload the project I create a keystore named: "myproject.keystore" and I give it the Alias and password: "myproject" as well.
Just like this:
$ keytool -genkey -v -keystore myproject.keystore -alias myproject -keyalg RSA -keysize 2048 -validity 10000
When I now upload the app to google play and it gets accepted I cannot see the map.
Try comparing your project settings between DEBUG and RELEASE to find a difference. Or check for any hard coded API keys or anything that that would be different between the two environments.
Edit:
So after your myproject.keystore is created, you need to extract the SHA-1 from that keystore and add that to the Credential list in Google.
So if you created your myproject.keystore in ~/Users/Someone/Desktop/, then you would extract the keystore the same way you did with the DEBUG version:
keytool -list -v -keystore ~/Users/Someone/Desktop/myproject.keystore
That should give you the second SHA-1 that you need to add to the Google site.

How to generate a keystore to update a published app?

I am quite new to android, this question maybe quite simple. But i do need your help. I am preparing to submit a update to google play now. When i export the android application, there is a keystore selection dialog. But i don't have the keystore. The project was developed by another company before. Now we only have the source code and the google play developer account. After reading the Signing Your Applications, i know i need to generate one. But there is still something i am not sure about this.
The keystore generate command as below:
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
This is a self-signed certificate. Is this sufficient for me to submit the update? Or need me to generate another one ? if so, then how to do that?
Any suggestion would be much appreciated.
For creating your own Keystore go to C:\Program Files\Java\jdk1.6.0\bin and execute below command
C:\Program Files\Java\jdk1.6.0\bin>keytool -genkey -v -keystore app.keystore -alias app -keyalg RSA -keysize 2048 -validity 300000
It'll created your app.keystore in C:\Program Files\Java\jdk1.6.0\bin directory and by using this keystore you can sign you application. You must keep this keystore safe because of your app next update.
Update: command for generate SHA-1 from your app.keystore
D:>keytool -v -list -alias app -keystore "D:app.keystore" -storepass app -keypass app
Right click to the project --> select Android tools -->Export signed Application package
this bring you to window "Export Android Application"
Complete the rest. this will give you signed apk as well as keystore
You can take help from this link too :https://www.youtube.com/watch?v=IYhJp-jqJyM
You'll need the original keystore, otherwise you won't be able to update the application on the Play Store. Ask the previous developer to give the one he used to sign the application, then save it in the safest place you can think of.

Obtaining Google Maps API key

I'm using Windows 7.
I have tried several times with the debug.keystore with appears in c:\users\YOURUSER.android\ using the command:
keytool -list -alias androiddebugkey -keystore c:\Users\YOURUSER\.android\debug.keystore -storepass android -keypass android
It gives me a MD5, but then I go to Google MD5 registration page and it sais it is not a valid fingerprint.
I searched for more information, and I finally created a new debug.keystore into c:\users\YOURUSER\ to avoid rewriting the original one. I used this command:
keytool -genkey -keypass android -keystore c:\users\YOURUSER\debug.keystore -alias androiddebugkey -storepass android -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
It works, so I use the previous command to get the MD5, and it gives me a new MD5. Then I go to Google again and the same problem: "not a valid fingerprint".
The I made a second attempt. This is what I did then:
1) Opened a Windows7 terminal, went to c:\program files\java\jdk1.7.0\bin\
2) Wrote command:
keytool -genkey -v -keystore c:\eclipse\my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
3) Then I tried to get the MD5 code from my keystore, using comand:
keytool -list -alias alias_name -keystore c:\eclipse\my-release-key.keystore
and writing the password I am asked. It gives me a MD5.
4) I go to maps api key sign up and write the MD5. "FINGERPRINT NOT VALID"
I don't know what the problem is. And I am supposed to do this for every app I program? What a headache!
Can anybody help me please?
Are you sure you get the MD5 and not the SHA1 fingerprint? Tryed the -v option?
see: How can I get the MD5 fingerprint from Java's keytool, not only SHA-1?
google maps has deprecated its previous version API v1 and introduced a new version of google maps API v2.
previously we generated md5 key but now we need to generate sha-1 fingerprint certificate.
The Maps API key is based on a short form of your application's digital certificate, known as its SHA-1 fingerprint. The fingerprint is a unique text string generated from the commonly-used SHA-1 hashing algorithm. Because the fingerprint is itself unique, Google Maps uses it as a way to identify your application.
please go through the links it could help you
https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key
https://developers.google.com/maps/documentation/android/intro#sample_code
also see the same kind of post in stack over flow
How to implement Google Maps new version of API v2
In command line you need to open Java-> jdk-> bin
as for me it is "C:\Program Files\Java\jdk1.7.0_03\bin"
There is "keytool" program which u need. In command line enter "cd C:\Program Files\Java\jdk1.7.0_03\bin"
And enter "keytool -list -v -keystore C:\Users\John\.android\debug.keystore"
So the final string in command line must look like:
"C:\Program Files\Java\jdk1.7.0_03\bin>keytool -list -v -keystore C:\Users\John\.android\debug.keystore". Whare usually u need only to change the name "John"
There will be SHA-1, MD5, etc
Finally, go to Google Access API google access api

Problems getting MD5 fingerprint

I try to generate a MD5 fingerprint to obtain a map api key using Java7.
I do it on the way, described at developer page
"C:\Program Files\Java\jdk1.7.0\bin\keytool" -list -alias androiddebugkey -keystore C:\Users\username\.android\debug.keystore -storepass android -keypass android
The problem is, I'm getting SHA1 Fingerprint and not MD5
androiddebugkey, 01.08.2011, PrivateKeyEntry,
Certificate fingerprint (SHA1): xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Any ideas why?
Thnak you in advance
Interesting. Well, you can get the entire cert information using this command.
keytool -list -v -keystore C:\Users\username\.android\debug.keystore
You'll need to enter android as the password when prompted. That will give you everything in the keystore, which should only be one certificate rather than looking for a specific alias. It should show you both an MD5 and a SHA1 fingerprint. Give that a try and let me know.
The only thing I can think of is that jdk1.7's keytool gets information differently than jdk1.6(returns SHA1 by default?). This is just a guess and has not been verified but it is the only thing I can really think of.
Edit: It appears my guess might be correct. JDK 7 changes keytool output
Ok. I solved the problem with this answer
I changed my call to "C:\Program Files\Java\jre6\bin\keytool" and ... everything works

android development, implementing google maps

straight from http://code.google.com/android/add-ons/google-apis/mapkey.html it says:
To register for a Maps API Key, you need to provide an MD5 fingerprint of the certificate that you will use to sign your application. Before you visit the registration page, use Keytool to generate the fingerprint of the appropriate certificate.
First, determine which key you will use to sign your application at release and make sure of the path to the keystore that contains it.
Next, run Keytool with the -list option, against the target keystore and key alias. The table below lists the options you should use.
I dont understand the directions to do this. I tried on the terminal using:
keytool -genkey -v -keystore microjobs.keystore -alias mjkey -keyalg RSA
and entered name, and city state then:
keytool -list
but it returns:
keytool error: java.lang.Exception: Keystore file exists, but is empty:
What should i do?
Thanks.
Might be an access problem to the folder ?
Also, later in the page you reference in your question, if you look here, Eclipse can help you generate and locate your API key.
Navigate to the folder containing the keystore file, and then run
keytool -list -alias your_alias -keystore your_file_name
where your_file_name is just the file name, without path.

Categories

Resources