GeeCON Prague 2014*
The moose likes Android and the fly likes How can i find apiKey and Where i use apiKey? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "How can i find apiKey and Where i use apiKey?" Watch "How can i find apiKey and Where i use apiKey?" New topic
Author

How can i find apiKey and Where i use apiKey?

fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
I find a apiKey with this way: i write in cmd keytool -v -list -alias androiddebugkey -keystore C:\Users\Fahimeh\.android\debug.keystore -storepass android -keypass android and i find apikey but apikey for final version is like debug version. Why?

When i find apiKey, How can i get final version? Should i select export ? Where i use apiKey? Do i use this in apikey of map in layout folder of my program?

Thanks

Regards
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
I'm afraid it's not clear what, exactly, you did, and what, exactly, the results were, other than that what you expected did not happen.

It sounds as if this part of your continuing quest to get Google Maps to work in your Android app. Which of the steps described in detail on this page have you taken? Have you deviated from those at all? Was each single step successful in the way described there?


Ping & DNS - my free Android networking tools app
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
Thanks Dear
I find apikey for final version and now what should i do? Do i paset apiKey in front of "android:apiKey=" in com.google.android.maps.MapView xml tag? i have apk file and keystore file but when i install in phone, the program not shows map.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
Once again:
Ulf Dittmer wrote: Which of the steps described in detail on this page have you taken? Have you deviated from those at all? Was each single step successful in the way described there?

That page describes in detail what you need to do in order to get and use a Google Maps key. We can't speculate on whether or not that has anything to do with the failure of your app to show a map, because we don't know what, exactly, your code does, nor whether there are any other problems or exceptions that might prevent it from working.

It seems a bit like at each step you're trying something that you think should work, and when it doesn't, you post here saying "my app doesn't work", but giving insufficient information for us to try to help you. Have you ever followed exactly the instructions? Have you ever tried to get a minimal example app up and running, like this one?

Note that the Google APIs download comes with ready-to-run source code named MapViewDemo.
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
I will say, what i did step by step.

1)I find apiKey for debug version and copy in front of android:apiKey="apiKey";

2)I right click in the name of program and select Properties and then select Android, select Google Api platforme 4.1

3)I connect my phone to computer and run the program on the phone. The phone shows maps and everything is ok !
----------------------------

1)I right click on the name of program in eclipse and select Androd Tools and then select Export signed application package and i create apk file and keystore file in Program Folder.

2)I find MD5 for final version by keystore address and alias name that i specified in export android application

3)I copy MD5 and paste in sign in page of google and obtain apiKey for final version.

4)I copy apiKey final in front android:apiKey= in program in eclipse.

5)I copy Program Folder in phone and install apk file but not shows my program!!

I use android 4.1 version android and google map libray but my phone has android 4.0.1/ Do relate to android version?!!

I guess the problem is the 4 or 5 part, becuase when i change apikey of program, apk file that i created and saved in Program Folder not changed!!
What do you think?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
It sounds as if you're building an app that relies on Google APIs for Android 4.1 on a phone that runs Android 4.0.1 - I wouldn't expect that to work.

I'm also unclear about some of what you write - e.g., what is "Program Folder" in step 5? How, exactly, are you trying to install the app on your phone?
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
Ulf Dittmer wrote:It sounds as if you're building an app that relies on Google APIs for Android 4.1 on a phone that runs Android 4.0.1 - I wouldn't expect that to work.

I'm also unclear about some of what you write - e.g., what is "Program Folder" in step 5? How, exactly, are you trying to install the app on your phone?


Program Folder is a Folder where i select for saved keystore and apk file of my program in Export android application. My program runs in my phone also my phone has android 4.0.1 version but not shows map.

Yes. I try to install the app on my phone and installed and run but not shows map.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
I'm getting more and more confused - now you're saying the map doesn't show in the app. In your previous post you said the app didn't show on the phone (which is why I asked how you're installing the app - if the app actually runs on the phone, then it most likely doesn't matter how it gets installed).

Based on your most recent post I'm now assuming that the app actually installs on the phone and can be run. Four questions, please answer all of them, as briefly as possible: 1) Have you tried building an app that uses Google APIS for Android 4.0.1 instead of for Android 4.1? If not, why not? 2) Are there any exceptions or other messages related to this app in the logcat output of the phone? If you don't know, then that should be the next step to find out. 3) Have you gotten, as I suggested earlier, the MapViewDemo that comes with the Google APIs to run successfully on your phone? 4) Do I understand correctly that the app runs fine as long as it's in debug mode, but when you switch to release mode (i.e., you try to sign it), it stops working?
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
Ulf Dittmer wrote:I'm getting more and more confused - now you're saying the map doesn't show in the app. In your previous post you said the app didn't show on the phone (which is why I asked how you're installing the app - if the app actually runs on the phone, then it most likely doesn't matter how it gets installed).

Based on your most recent post I'm now assuming that the app actually installs on the phone and can be run. Four questions, please answer all of them, as briefly as possible: 1) Have you tried building an app that uses Google APIS for Android 4.0.1 instead of for Android 4.1? If not, why not? 2) Are there any exceptions or other messages related to this app in the logcat output of the phone? If you don't know, then that should be the next step to find out. 3) Have you gotten, as I suggested earlier, the MapViewDemo that comes with the Google APIs to run successfully on your phone? 4) Do I understand correctly that the app runs fine as long as it's in debug mode, but when you switch to release mode (i.e., you try to sign it), it stops working?


1) I builded an app that uses Google APIS[android 4.1] and run this app in phone with android 4.0.1 version.
2)I dont know. but my program run correct
3)what do you mean? I don't understand what you say!
4)Yes. When i install final apk file on phone, the program install and run but not show map. just the program shows grid page and shows button not show map and location.

Thanks

EDIT: I think, i find what is my problem! I can't how can i change the Maps API Key strings referenced by all of MapView elements??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
#2 - What do you mean, "my program run correct"? This whole topic is about how it does not run correctly, yes? Logcat output is a very useful tool for debugging; you really need to know it and use it.

#3 - I'm not sure how to ask that in a simpler way, so let's leave it aside.

#4 - Time to examine the logcat output.

Given that your code works in debug mode, but not release mode, let me ask you this: have you ever gotten any of your apps to work in release mode? Which is to say, do you know in principle how to sign and release an app, and have done it successfully?
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
NO, i dont publish any program for run the program and this not run full in the phone. I dont know when i find apikey,where i use this? in which class or file?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
I give up. Sorry, but I see no inclination on your part to learn the crucial skills you need to develop applications, or to take steps to work around problems and to try something on your own. Your entire problem solving strategy seems to consist of posting here with too few details to let us help you effectively, all the while ignoring the advice you get. Good luck with your app.
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
Ulf Dittmer wrote:I give up. Sorry, but I see no inclination on your part to learn the crucial skills you need to develop applications, or to take steps to work around problems and to try something on your own. Your entire problem solving strategy seems to consist of posting here with too few details to let us help you effectively, all the while ignoring the advice you get. Good luck with your app.


NO, i can't speak good english and i think because this, you don't understand my text .

You tell me, i get logcat of program! but when i install apk file in my phone and the program runs independent of eclipse, what i get logcat??!!!

I apply full of your answer but apk file not shows map. I think my problem is in change of pikey of program with pikey debug version.

anyway. Thanks for anything. Thanks my friends.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
You tell me, i get logcat of program! but when i install apk file in my phone and the program runs independent of eclipse, what i get logcat?

This is a good example of your approach: you post that question here, but seem to have done nothing to figure this out on your own. logcat has nothing to do with Eclipse. All you need is the Android SDK and a USB connection to your device. It's all explained in the Android developer docs, which you should consider required reading: http://developer.android.com/tools/debugging/debugging-log.html
 
GeeCON Prague 2014
 
subject: How can i find apiKey and Where i use apiKey?