Discussion Forums  >  Maps, Device Location, Tracking

Replies: 16    Views: 450

Kyle Boyett
Lost but trying
Profile
Posts: 32
Reg: Jan 03, 2015
Waynesville, GA
6,570
01/19/15 12:31 PM (9 years ago)

Newbie trying to get a map to display

Hello everyone, I'm fairly new to all of this coding, and have run into a snag. I'm currently working on a simple app, and have gotten most of my pages to work. They're just not pretty, but I'll clean it all up later. The issue I'm currently trying to tackle is the location map plug-in. After much trial and error, I've got my device to load up the screen, but no map is displayed. It shows 'Google' in lower left corner, +/- on lower right for zoom, user location symbol in upper right, and a pin icon on very bottom of screen. There is no map loaded in the main screen, and pressing any of these buttons has no effect. Prior to this screen, the only thing I was getting was a symbol for a missing plug-in. Got past that, but now I'd really like to see a map. I've got the coordinates for one location entered in the screen details. But, still no visible map. When the map screen first loads up, at bottom it says '1 location', but nothing else every shows up. This is for Android, using Eclipse. I believe I've pasted my API key in all the necessary places, but like I said, I'm new to this. Any help would be greatly appreciated. Thank you, Kyle
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
01/19/15 01:29 PM (9 years ago)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/19/15 01:34 PM (9 years ago)
Hi Kyle, Couple of things: * It doesn't work well, and sometimes not at all, on an emulator. So make sure you use a real device if you can. * Make sure you're using the same key to sign your app as you did in generating your APK key. * If you can, hook up your device to Eclipse and see what LogCat says. Lots of times there is good data to be found there. Mark
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/19/15 02:01 PM (9 years ago)
If anything has changed and my recipe needs updating, let me know. Alan
 
Kyle Boyett
Lost but trying
Profile
Posts: 32
Reg: Jan 03, 2015
Waynesville, GA
6,570
like
01/19/15 04:08 PM (9 years ago)
Thanks for the replies.... Been hard at work on this since I posted, and here's my progress. Keep in mind, I'm completely new at this, and have no clue about java, xml, or any type of programming... lol I'm using my old phone as a test device, hooked up directly to the pc. Looking through the logcat, it kept stating authorization failure....unable to connect to Google... or something to that effect. I confirmed my Google Maps Android API v2 was turned on, and set up. I even created multiple keys, trying each one with same effect. I searched google for 'google maps authorization failure', and read many pages of results. Not sure what made me think of it, but this is where I found my mistake. I had been using the keytool inside of eclipse to locate my SHA1 fingerprint to plug into my Google Console, and generate my API key to enter into the android manifest.xml file.... I even tried to generate a debugging key using same 'keytool' in eclipse. No luck there, either. I finally used the command line keytool -list -v -keystore %HOMEPATH%\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android That did nothing until I read how to add the path for it to work. Using the command again, it generated a completely different SHA1 fingerprint, but I entered that into the console, and generated another API key...plugged that into the manifest, and now, I've got a working map. Map is working....Yeah!!! Whew.... I'm tired. My concern now, is why are the fingerprints different, and if the one from the keytool inside of eclipse isn't the right one, why is it there? Also, I'm assuming, that once I decide my app is finished, I'll need to figure out my release fingerprint. Would the release key from eclipse work then, if I packaged it as .apk from eclipse? It'll be awhile yet before I'm close to being done, but this is at least another step forward. Oh, btw, during my revisions made trying to get the maps to work, I've lost a feature I need back, lol. I think I've downloaded about 14 versions of this app so far and somewhere around 7 or 8, this changed and I can't find what I did different. I've got a home screen with multiple buttons on it and some of the text is too long to fit on one line so they get cut off. In my earlier versions, I figured it out....I'm pretty sure I changed a line to read maxlines=2 or something similar....can't find that line again anywhere. Any points in the right direction would be helpful. Thanks again for the replies, and sorry for the long post..... Kyle
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/19/15 04:20 PM (9 years ago)
Hey Kyle, No apologies needed for the "long" post...that's how we all learn! Android development is buggy process, so it's always helpful to see what people are up against. When you say the "Eclipse keytool," are you talking about the Keytool Plugin (http://keytool.sourceforge.net/) or something that was already there? I use the Keytool Plugin quite often, and have never experienced the issue you describe. It has always given me the correct SHA1 fingerprint. When you go to publish your app, you'll need to generate a release keystore. You can also do this using the Keytool Plugin at any time during the process you want. You can use the same keystore to sign all your apps...that's what I do. Once you generate that keystore, you'll need to get its SHA1 fingerprint, then paste it into your developer console, and get the new API key. Same procedure as with the debug keystore, but with the release keystore. Glad you got maps working! It's one of the biggest hurdles you'll face...so you can breath easy now! Mark
 
Kyle Boyett
Lost but trying
Profile
Posts: 32
Reg: Jan 03, 2015
Waynesville, GA
6,570
like
01/19/15 05:08 PM (9 years ago)
Yes, the Keytool plugin. It installs "Keytool" with a key icon next to it on the top menu bar. I do see an option in there to select between 'Java keystore (JKS)or PKCS 12' Mine is set at Java, but it definitely gives me a different key than the command line did. Unless I did something incorrect when creating it. There are a lot of field to fill in, and not sure if they are all required. Oh well....it's working right now, lol. Thanks, now if I can only find that line to fix the text on the buttons.....
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/19/15 06:17 PM (9 years ago)
Unlike iOS, you'll find most of your screen 'layout' in an xml file. If you're working with 'bt_ScreenSomething.java', then if you wanted to view the 'screen', you would go to /res/layout and find the accompanying 'bt_screensomething.xml' file. That's probably where you'll be able to fix your button text. Let me warn you; I hate Android XML with all my guts and liver. You may not find it the 'easiest' thing to work with, but you'll have to power through it. There isn't many ways around it. Cheers! -- Smug
 
Kyle Boyett
Lost but trying
Profile
Posts: 32
Reg: Jan 03, 2015
Waynesville, GA
6,570
like
01/20/15 05:21 PM (9 years ago)
I completely understand your warning, lol. I'm learning to hate it as well. I finally found what I needed to change for my text to appear on two lines inside the button... It was within the BT_screen_menuButtons.java.... This is what the lines around it show, in case anyone else needs to find it... //if we have text... if(titleText.length() > 1){ TextView t = new TextView(this.getActivity()); t.setText(titleText); t.setTextSize(buttonLabelFontSize); t.setTextColor(BT_color.getColorFromHexString(buttonLabelFontColor)); t.setLines(1); t.setSingleLine(true); t.setLayoutParams(new LayoutParams(tmpWidth, tmpHeight)); t.setWidth(tmpWidth); t.setMinimumWidth(tmpWidth); t.setMaxWidth(tmpWidth); t.setHeight(tmpHeight); t.setMinimumHeight(tmpHeight); t.setMaxHeight(tmpHeight); I changed these lines t.setLines(1); t.setSingleLine(true); to read t.setLines(2); t.setSingleLine(false); After changing, I uninstalled it from my phone, and re-ran the app. (Not sure if I had to un-install, but figured it wouldn't hurt). Once doing this, the buttons with long text automatically wrap to 2 lines. See, I knew it was a simple fix....just took ages to find that line again. Kyle
 
Tyroner
Aspiring developer
Profile
Posts: 175
Reg: Dec 26, 2012
Johannesburg, S...
4,200
like
01/21/15 11:18 AM (9 years ago)
I have exactly the same problem. I created my Maps API with release key but running app under debug key. Could that be the problem?
 
Tyroner
Aspiring developer
Profile
Posts: 175
Reg: Dec 26, 2012
Johannesburg, S...
4,200
like
01/21/15 11:24 AM (9 years ago)
I get this error when I try to run the release version: "app-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog." Not sure where to go to correct this.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/21/15 11:27 AM (9 years ago)
For your first question, yes, that is the problem. The API key has to be generated using the same keystore that you sign your app with. Otherwise it simply won't work. For the second question...did you use the Export function in Studio? It should have given you the option to sign using an existing keystore or create a new one. Mark
 
Tyroner
Aspiring developer
Profile
Posts: 175
Reg: Dec 26, 2012
Johannesburg, S...
4,200
like
01/21/15 11:39 AM (9 years ago)
I used Studio to Generate Signed AP. I first created a debug keystore and then when I created the Maps API I created a release keystore. I used the release keystore to create the Maps API. I'm not sure why Studio says that my keystore is unsigned. Where will I be able to fix this or must I create a new keystore?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/21/15 11:43 AM (9 years ago)
If you created a release keystore, and you know where it is in your system, you should be able to select it during the export process. I can check on this when I get home tonight.
 
Kyle Boyett
Lost but trying
Profile
Posts: 32
Reg: Jan 03, 2015
Waynesville, GA
6,570
like
01/21/15 05:22 PM (9 years ago)
I haven't gotten that far yet, but have been thinking that I may try to export as a release, and see if I can get that to work. I'm expecting issues, but you never know. Good luck with your issue. I'm sure the guys here can point you in the right direction.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/21/15 05:29 PM (9 years ago)
For what it's worth, you can test with a release version instead of a debug version, and then creating a new apk for release. LogCat info is still available, and you can still have your app in Design mode with a release keystore. Just remember to switch it over to Live mode before you publish your app! And guard your release keystore with your life. If you loose it, you won't be able to update your app, and you'll have to create a new version. If you loose the release keystore, there's no way to get it back. Mark
 
S-George
Apple Fan
Profile
Posts: 111
Reg: Jan 18, 2012
location unknow...
4,460
like
06/20/16 08:52 AM (8 years ago)
sorry!!!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.