Discussion Forums  >  Maps, Device Location, Tracking

Replies: 32    Views: 531

ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
09/24/13 12:29 PM (10 years ago)

The method getLatitudeE6() is undefined for the type GeoPoint

This is the last error I need to fix before I can take my new buzztouch app for a spin. I've learned lots of *other* things while trying to work it out but now I'm stuck. Help me, Obiwan Kenobe; you're my only hope. When I mouse over the error on; getLatitudeE6 I get this error: The method getLatitudeE6() is undefined for the type GeoPoint Here's a larger section of the code where this appears: public void setMapBoundsToPois(List<GeoPoint> items, double hpadding, double vpadding){ BT_debugger.showIt(activityName + ":showMapPins"); //reference to map controller.. MapController mapController = mapView.getController(); //if there is only on one location directly animate to that location if(items.size() == 1){ mapController.animateTo(items.get(0)); }else{ // find the lat, lon span int minLatitude = Integer.MAX_VALUE; int maxLatitude = Integer.MIN_VALUE; int minLongitude = Integer.MAX_VALUE; int maxLongitude = Integer.MIN_VALUE; // Find the boundaries of the item set for (GeoPoint item : items) { int lat = ((GeoPoint) item).getLatitudeE6(); int lon = ((GeoPoint) item).getLongitudeE6(); maxLatitude = Math.max(lat, maxLatitude); minLatitude = Math.min(lat, minLatitude); maxLongitude = Math.max(lon, maxLongitude); minLongitude = Math.min(lon, minLongitude); } ...I have two more errors but they depend on this part working. Any help appreciated!!
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 01:32 PM (10 years ago)
For example...where should I even begin to look? I've installed a Google API code and enabled all the mapping services there. Could this be related to something external like that, or is it a problem somewhere within my code? This is pretty much the pure code that BuzzTouch created, so I assume I'm not the only one experiencing this, but I couldn't find it after skimming hundreds of other forum posts. BTW is there a search feature for the forum? Code hinting suggests "Change cast of item," which changes the line to this: int lat = ((GeoPoint) item).getLatitudeE6(); int lon = ((GeoPoint) item).getLongitudeE6(); It also suggests changing getLatitudeE6 to getLongitudeE6, but the error remains it just suggests changing it back.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 02:14 PM (10 years ago)
Which plugin is this for? Or is this custom code you are writing?
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 02:21 PM (10 years ago)
Here's a quick description of my app: 1. Basic menu with a bunch of items. 2. Tap an item and a map opens, showing a location. 3. Tap that map and it displays driving directions. 100% automatic BuzzTouch download. I do html, css and php, and have barely worked with javascript, so I'm keeping it simple for now. That would make my plugins: Menu Simple and Location Map. Thanks for asking.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 02:23 PM (10 years ago)
[removed]
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 02:32 PM (10 years ago)
So, I'm not finding the getLatitudeE6 string in my copy of the BT_screen_map.java, which is the file for Location Map. Can you provide me the filename that you're looking in? Also...is this the Android v3 code, or the older v2 code? Finally...I'll assume if it's the v3 code, you've imported the Google Play Services, and also selected the Android SDK for your project? And that if it's the v2 code, you've selected the correct Google SDK for your project? Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 05:33 PM (10 years ago)
yeah, it's in BT_screen_map.java. It probably was v2 code since I meant to make this available on my Android 2.3 phone (idk if that's even related...). When you say "if it's the v3 code, you've imported the Google Play Services, and also selected the Android SDK for your project", I have imported GPS and to select the A SDK, do I right click the project in Package Explorer > Properties > Android > and select Android 3.0? I had it on Google APIs 2.2 8 but just switched to see if that removed errors without luck. I'm starting over from scratch with v3 and I'll see how it goes and include some of the things I'm learning in case it helps anyone spot my error or someone else finds this thread useful, even though this may not be very precise. A. Get the Google API key thing B. Add these as children of the <manifest> tag in the project's Androidmanifest.xml just in case: <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <!-- The following two permissions are not required to use Google Maps Android API v2, but are recommended. --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> C. Import Google Play services (File > Import > Existing Android Code > SDK > etc.) D. FYI I just verified that getLatitudeE6 doesn't exist in the v3 version. It was deprecated code. But now I have many other errors. This is good practice repeating what I learned on my first attempt. E. Right click the project in Package Explorer > properties > Android > Google APIs 2.2 (seems like the BT videos emphasized that, I hope it's not outdated) > OK. F. Open SDK Manager and select/download everything that says Google APIs on it, plus everything in Tools and Extras, just in case. G. In Android Virtual Device Manager, make sure Google APIs, Platform 2.2, API Level 8 is selected. Or rather, create a device with that setting. H. File > Refresh to see if anything happens. Nope. I. Wonder if my 2.2 stuff and v3 stuff doesn't match and is causing many errors, and where to fix that. Set up a different virtual device with Android 3 instead of Google 2.2. J. Wonder if I shouldn't have selected all versions of Google API in the SDK manager and if that's creating errors, but I think that just downloads them, and doesn't designate anything for this project. That's where I'm at right now. Thanks so much for the help! All you guys who boost up us newbies with such basic questions (I'm sure) are amazing!
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 05:38 PM (10 years ago)
Just noticed that I have a Google Maps Android API v2 key. Should I have v3? Can't see that anywhere. I think the v3 I downloaded from BT was Android, not Google, but I mention this in case I'm wrong.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 05:43 PM (10 years ago)
Here are some of my lines of code that cause errors in case it makes it obvious what I'm missing: In BT_screen_map.java: bt_screen_map_marker_device R.drawable.bt_screen_map_youarehere R.id.mapView In BT_act_controller.java: sarlocade_appDelegate.rootApp.getTransitionTypeHistory().add(theTransitionType); In BT_activity_host.java: actionBar.setHomeButtonEnabled(true); In BT_screen_map.java: R.layout.bt_screen_map In BT_screen_manuButtons.java: bt_screen_menubuttons
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 06:04 PM (10 years ago)
OK, so...you're basically making things about 100X harder than they need to be! Here's a video that I did that shows how to go from the Control Panel to the Android Emulator: http://www.youtube.com/watch?v=NV3Ofi2602I This is for the Version 2 Buzztouch code, which is the default package you get when you prepare your package for download, unless you deliberately select the Version 3 code. You should easily see the two links. If you download the Version 3 code, watch the video first still, but then follow the PDF file that comes with your package download. Follow the steps, and all should be good! Give that video a view, and let me know if you have other questions. Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 06:25 PM (10 years ago)
Just noticed that I have a Google Maps Android API v2 key. Should I have v3? Can't see that anywhere. I think the v3 I downloaded from BT was Android, not Google, but I mention this in case I'm wrong.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 07:47 PM (10 years ago)
Excellent vid. Clear & concise. Your vids belong on BTU, ya know? I wish you were right about "all should be good." When I change Properties > Android > to Android 4.0 API 14 like the PDF instructs, scr folder files fill up with errors. There's also one error in res > layout > screen_map.xml. When I change it to Google APIs 2.2 API 8, only two files have errors: res > values > themes.xml on line: <item name="android:windowActionBar">false</item> Code Hint: error: Error: No resource found that matches the given name: attr 'android:windowActionBar and src > BT_screen_map.java, which has a few things like: BT_screen_map "The hierarchy of the type BT_screen_map is inconsistent" which seems to trigger other errors like: startActivity, getActivity, and getFragmentManager, which are "undefined for the type BT_screen_map" and "R cannot be resolved to a variable" I looked in the manifest and I assume this line confirms that I'm using v3 from BT: <!-- File Version: 3.1: 08/28/2013 --> And I was careful to make sure I downloaded all Android 4.0 API 14 items in the SDK manager.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 10:34 PM (10 years ago)
I'm in the process of putting together a video on how to compile a Buzztouch v3 app. Here's some raw video...not yet posed to YouTube. You're the first to see it! https://www.dropbox.com/s/gmq1i2ovtk2kepz/Android%20v3_HD.mp4 Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 11:04 PM (10 years ago)
An honor. Thanks! And another superb video. I've done all those things (and triple checked) just as you showed, but still get numerous errors. I'm going to start from the beginning once more and see how it goes. I'm getting faster!
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 11:05 PM (10 years ago)
Way to hang in there! Let me know if you'd like to do a TeamViewer session. I can hop on your system and check things out. Might be something super simple. Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 11:11 PM (10 years ago)
Thanks! I just created a super simple 2 screen version of my app to try out. If it doesn't work, I will take you up on your generous offer!
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 11:13 PM (10 years ago)
Sounds good! Standing by!
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/24/13 11:27 PM (10 years ago)
I thought it was going to work (started launching the virtual device, but I hadn't yet deleted the libs remove file as you suggested) but then the same errors showed up in BT_screen_map.java as before. I'd better get some sleep for now. Everything will work better tomorrow :) FYI in case you want to try to replicate this, here's my exact app setup: 1. On screens/actions, add: a. row title: my house b. new or existing screen: my house c. choose if adding screen: location map 2. once that menu exists, click "my house" under "tapping this row loads" 3. a. title: my house b. sub-title: input your home address c. tab through lat/long fields d. callout window tap action: show driving directions e. click add The end. Download project, etc.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/24/13 11:31 PM (10 years ago)
I'd rather check out your particular project and see how things are set up. I've compiled a number of them and they all work, so it's possible you're just missing something that's easy to fix. Send me an email tomorrow at MrkFleming at gmail dot com if you want to do the TeamViewer thing. I'll also be up for a bit longer tonight. Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 12:32 PM (10 years ago)
First the good news. The project has no errors and launched fine in my virtual device. What did I do differently? I don't know, but there must have been something. The only thing I can think of was creating a different virtual device. Now the less-good news. The maps don't work in my app. I didn't have my google API key meta tag added to the manifest at first, so I added that and clicked Run again with the same results. Getting closer!
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/25/13 12:36 PM (10 years ago)
Rock on! Was just about to send you an email for TeamViewer. For the keys stuff...what keystore did you use to get the maps key? In order for the maps to work, the app has to be signed with the same keystore used to get the SHA1 hash, and ultimately the API key. Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 12:41 PM (10 years ago)
I'm not totally familiar with all those terms, so I hope this answers your question. I got the API from https://code.google.com/apis/console/#project:672773290142 and put it in the following tag just before </application> in the manifest file: <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIyC-etc."> Is there more?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/25/13 12:45 PM (10 years ago)
This is the set of instructions you want to follow to get your key: https://developers.google.com/maps/documentation/android/start#obtaining_an_api_key The SHA1 hash can be found for your keystore (the key you use to sign your app) by installing the Keytool plugin for Eclipse. Google it, and you should be able to find it. Once you have the key, you have to sign the app with the same keystore you used to request the map key with. Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 01:45 PM (10 years ago)
I got the SHA1 and Keytool part done and am stuck learning now to sign the app with that keystore. Google has led me to details about Jarsigner that may be getting more complex than I need to know...
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/25/13 01:53 PM (10 years ago)
Yep, way more complex. When you export your app (File...Export), it'll ask for the keystore you want to use. Simply use the same one that you used to get the SHA1 fingerprint from. If it's the debug.keystore, it'll be on your system somewhere, depending on the OS (you should be able to search for debug.keystore). It's in the .Android folder. If you created your own keystore, us that one, and sign it with it. The export wizard walks you through it.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 03:13 PM (10 years ago)
I must be getting very near the end and success, bc I'm finally beginning to tire of the complexity...but I won't give up now. A. Should maps work when I run the app in the emulator before exporting it? If not, then maybe everything is okay. B. I exported it to my phone, but since it runs Android 2.3.7, I assume that's why it wouldn't install there.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 08:24 PM (10 years ago)
I got some friends to install the app and confirm that it works just like on my virtual device. That means I'm almost finished and will have a useful little app for new members of my search and rescue team to show all the locations they may not be familiar with! Now to review all those google map components, settings, etc.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 08:30 PM (10 years ago)
If you're still available for that TeamViewer session, it would be very welcome :)
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 08:39 PM (10 years ago)
When I perform the operation that fails, log cat says "Google Play Store is missing." That's gotta be significant.
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 08:58 PM (10 years ago)
I have Google Play Services in my Package Explorer, but it only shows Android 2.2 inside (along with android private libraries, dependencies, src and other folders and files). Should it have 4.0 there, too? In SDK manager, it shows that I've installed Google APIs for every Android OS level, and all tools and extras. I deleted the GPS folder and reimported it in case that would bring in APIs downloaded after the folder was first built, which of course didn't help or I wouldn't be writing this :)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/25/13 10:07 PM (10 years ago)
Howdy! Was out and about tonight...sorry for the delay in answering. So...where do you stand? Did you get the maps working? They should work in the emulator so long as the Android Maps Key was obtained using the SHA1 hash from the debug.keystore, which is what's automatically used to sign apps for the emulator. Mark
 
ShaunR
Lost but trying
Profile
Posts: 23
Reg: Sep 22, 2013
Orem
3,730
like
09/25/13 10:41 PM (10 years ago)
I'm afraid I have again messed things up worse as I tried various things when it wasn't working. It's possible that at one point I merely had the wrong key in the keystore (I noticed I had a duplicate meta tag, for example, in the manifest). Now I'm certain that's correct, but...want to try that teamview?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/25/13 10:48 PM (10 years ago)
You should not need to make any changes to the manifest file except for adding the maps api key. Everything else should remain as is, unless you have a compelling reason to change it. Send me an email with your TeamViewer login and PW, and we'll see what we can work out. Mark
 

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.