Discussion Forums  >  Maps, Device Location, Tracking

Replies: 17    Views: 167

GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
08/11/16 10:54 PM (3 years ago)

Maps on Android: Why Africa?!

Hello,

I'm helping somebody use the location plugin in their Android app, but we're running into issues. The map displays (which took us several days to get working due to keystore issues), but when it opens, instead of showing the requested state and the designated points, it opens to show basically the west side of Africa! I can't figure out what the deal is. Here is some LogCat output:

08-11 22:41:09.876: W/ZZ(28393): BT_activity_host:onLocationChanged The device's location changed.
08-11 22:41:09.876: W/ZZ(28393): BT_activity_host:onLocationChanged From: GPS Lat:: 32.43004814891627 Lon:: -110.97179634008896 Accuracy:: 48.0
08-11 22:41:10.773: W/ZZ(28393): BT_activity_host:onLocationChanged The device's location changed.
08-11 22:41:10.773: W/ZZ(28393): BT_activity_host:onLocationChanged From: GPS Lat:: 32.430022631516174 Lon:: -110.97178542396124 Accuracy:: 32.0
08-11 22:41:11.781: W/ZZ(28393): BT_activity_host:onLocationChanged The device's location changed.
08-11 22:41:11.781: W/ZZ(28393): BT_activity_host:onLocationChanged From: GPS Lat:: 32.430022631516174 Lon:: -110.97178542396124 Accuracy:: 32.0
08-11 22:41:12.755: W/ZZ(28393): BT_activity_host:onLocationChanged The device's location changed.
08-11 22:41:12.755: W/ZZ(28393): BT_activity_host:onLocationChanged From: GPS Lat:: 32.430022631516174 Lon:: -110.97178542396124 Accuracy:: 8.0
08-11 22:41:12.755: W/ZZ(28393): BT_activity_host:onLocationChanged turning off GPS to save battery, saved last location.
08-11 22:41:12.756: W/ZZ(28393): BT_activity_host:stopListeningForLocationUpdate (stopped listening to location changes)

Based on that, the device is obviously reporting a location.

08-11 22:41:16.784: W/ZZ(28393): BT_screen_map:onCreate. Found Google Maps v2 API Key: AIzaSyBefmLuk9wE8Mawz2jyzyVvVVaVYXXXXXX

And it's finding a key.

08-11 22:41:19.636: I/b(28393): Sending API token request.
08-11 22:41:20.056: I/b(28393): Received API Token: AH0uPGEeR7JnhffQ24xmLKrAclD_BYCfqQB7s3-8y4XROutIFbAYBi8wECLZtF7OlXQoNcM74sfomZiu3gGeXpixNX4XGt4tL8TcTmvFn55zJpxA9BGWXC5o_zhIDOvDo-05j2xxoC4TyKrpz6UTIRzp5uHxoWQh5BLyd2vGignnkfOILmAWXXXXXXXXXXXXXXXX / Expires in: 432000000ms
08-11 22:41:20.056: I/c(28393): Scheduling next attempt in 431700 seconds.
08-11 22:41:20.059: I/d(28393): Saved auth token

The maps token appears to be OK.

08-11 22:41:20.556: W/Google Maps Android API(28393): GLHudOverlay deprecated; getDrawOrder(): no-op, return DrawOrder.HEADS_UP_DISPLAY
08-11 22:41:20.556: W/Google Maps Android API(28393): GLHudOverlay deprecated; getDrawOrder(): no-op, return DrawOrder.HEADS_UP_DISPLAY
08-11 22:41:20.556: W/Google Maps Android API(28393): GLHudOverlay deprecated; getDrawOrder(): no-op, return DrawOrder.HEADS_UP_DISPLAY
08-11 22:41:20.563: W/Google Maps Android API(28393): GLHudOverlay deprecated; getDrawOrder(): no-op, return DrawOrder.HEADS_UP_DISPLAY
08-11 22:41:20.563: W/Google Maps Android API(28393): GLHudOverlay deprecated; getDrawOrder(): no-op, return DrawOrder.HEADS_UP_DISPLAY
08-11 22:41:20.563: W/Google Maps Android API(28393): GLHudOverlay deprecated; getDrawOrder(): no-op, return DrawOrder.HEADS_UP_DISPLAY
08-11 22:41:20.586: W/Google Maps Android API(28393): GLHudOverlay deprecated; draw(): no-op
08-11 22:41:20.981: W/Google Maps Android API(28393): GLHudOverlay deprecated; draw(): no-op
08-11 22:41:21.026: W/Google Maps Android API(28393): GLHudOverlay deprecated; draw(): no-op
08-11 22:41:21.069: W/Google Maps Android API(28393): GLHudOverlay deprecated; draw(): no-op
08-11 22:41:21.102: W/Google Maps Android API(28393): GLHudOverlay deprecated; draw(): no-op
08-11 22:41:21.143: W/Google Maps Android API(28393): GLHudOverlay deprecated; draw(): no-op

And that's pretty much it! That seems to be the issue, but I'm not sure what the problem is.

Anybody else having maps issues on Android?

Thanks!

Mark
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/11/16 11:04 PM (3 years ago)
I'll add that I'm compiling with the following in my build.gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.someappname"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies{

//compile possible .jar files in the libs directory...
compile fileTree(dir: 'libs', include: ['*.jar'])

//Google Play Services for Google Cloud Messaging and Google Maps...
compile 'com.google.android.gms:play-services-base:6.5.87'
compile 'com.google.android.gms:play-services-maps:6.5.87'
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
08/11/16 11:09 PM (3 years ago)
To the west of Africa is 0 degrees lat and long (where the equator meets a point that is in-line with Greenwich, London) - presumably the default setting for Google maps.

I haven't used maps in an app so hopefully experts such as Smug will turn up.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/11/16 11:16 PM (3 years ago)
Yep, that totally makes sense! But it should center on wherever my current location is, I would think...at least that's the way it's worked for me in the past. I agree...hoping Smug chimes in!

Thanks for the feedback!

Mark
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
08/11/16 11:26 PM (3 years ago)
BT_activity_host:onLocationChanged turning off GPS to save battery, saved last location.

Is this line the issue? Are you in some kind of battery saving mode on your device?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/11/16 11:29 PM (3 years ago)
I thought about that as well, but If you also notice, it saved my location when it first got it. I went through settings and tried to change it to something that didn't try to save battery, but that didn't seem to help. This is on a Nexus 7 tablet. I'm going to try an actual phone soon.

Mark
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
08/11/16 11:30 PM (3 years ago)
Feel free to ping me your apk at any point if you need your app user-testing.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/12/16 12:05 AM (3 years ago)
Will do...thanks! Just tested it on a phone with the same results, so it's not the device.
 
miku
Aspiring developer
Profile
Posts: 404
Reg: Feb 20, 2014
zagorje ob savi
10,590
like
08/12/16 12:15 AM (3 years ago)
I have the same problem with Smugs Message Location plugin for Android: always 0,0. I asked Smug and he found that decimal in coordinates are different in Europe than in America - "." and ",". He promised to solve this problem, I hope soon.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/12/16 07:41 AM (3 years ago)
Krompa nailed it when he mentioned the coordinates 0,0... When 'any' map doesn't get coordinates in a timely fashion, it defaults to 0,0 which ends up being off the coast of Accra, Ghana.

In both iOS and Android, David set it up so that when the app starts, and has locations enabled, the GPS will located the device coordinates, update for a while, and then shut off to save battery power. This can be overridden in code, but it's usually not needed, unless you're tracking something or recording waypoints. So usually you're good.

Oddly enough, the two functions (Pin placement and Map appearance) are not really 'connected' technology wise... they just function 'separately while together' so if one works and the other doesn't, it's because they're not really related.

If you ever need current device coordinates, they're held as a string value in the BT Root App Device properties.

String tmpLatitude = yourApp_appDelegate.rootApp.getRootDevice().getDeviceLatitude();
String tmpLongitude = yourApp_appDelegate.rootApp.getRootDevice().getDeviceLongitude();

Usually what I'll end up doing, is having the Map zoom off to the correct location as almost the last thing that happens in the 'onCreate' method of the Map Plugin Class

double dLat = Double.parseDouble(tmpLatitude);
double dLng = Double.parseDouble(tmpLongitude);

mapView = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapView)).getMap();
LatLng latLng = new LatLng(dLat, dLng); // New Center of Map
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 8); // 8 = Zoom
mapView.animateCamera(cameraUpdate);

Miku: Sorry I haven't had time.

Cheers!

-- Smug
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/12/16 08:35 AM (3 years ago)
Hi Smug,

Good stuff! I'll check into that, and see if that's the issue. The thing that concerns me is that we haven't made any changes to the map plugin file, so I would expect everything to just work out of the box. But, you never know. Thanks for the lead, and I'll let you know what happens!

Mark
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/12/16 09:51 AM (3 years ago)
Ah but there are many, many changes in the latest version of the map plugin, if you're talking the BT screen map.

The Android side has been totally rewritten. Lots of new code to accommodate Googles change in Map API and stuff... Happened... I'm not sure. At least 5-6 months ago, maybe longer. I noticed it when I went to build my flight tracker plugin...

Also, we can now see maps in the emulator again. This means you could plugin any coordinate you want in the emulator, if you don't have a device handy...

Cheers!

-- Smug
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/12/16 09:56 AM (3 years ago)
Well, this is a new download of the project, so presumably it should work with any of the changes from the past, right? I would assume David had tested everything.

In any event, I'll check it out, and give the simulator a shot as well. I hadn't realized that was working!

Thanks!

Mark
 
USofWine
Aspiring developer
Profile
Posts: 87
Reg: Apr 21, 2012
Denver, CO
5,370
like
09/07/16 03:38 PM (3 years ago)
Hi All! Still troubleshooting this issue....I've downloaded a new package, keyed everything etc and it's still crashing when maps are opened in an app.....Is anyone available to do testing to find a solution? Mark and I are at the end of options....
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/07/16 03:51 PM (3 years ago)
I mentioned that I could look, but since then I haven't heard anything.

Cheers!

-- Smug
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
09/07/16 03:57 PM (3 years ago)
Hey Smug...Ashley said she sent you a DM? Did you get it?

Thanks!

Mark
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/07/16 05:07 PM (3 years ago)
I did. and I replied. And I haven't heard anything. ;)

Cheers!

-- Smug
 
USofWine
Aspiring developer
Profile
Posts: 87
Reg: Apr 21, 2012
Denver, CO
5,370
like
09/07/16 05:19 PM (3 years ago)
There is nothing in my message box here...sorry! My email is ashleyanderson015@gmail.com if you want to email and we can go from there...
 

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.