location aware gps realtime (android)

6779
14
Jump to solution
07-21-2014 11:46 AM
by Anonymous User
Not applicable

Where do I find the android sdk to allow gps in realtime. Like the ESRI app where the gps move with you.

14 Replies
ThomNgo
Deactivated User

Hi Shelly,

From your sample, I'm wondering what's the use of zoomToWidth? When I debug, I saw this value changes but Envelope zoomExtent always the same, meaning the zoom scale at the end is the same.

With mMapView.setExtent(zoomExtent, 0, false), the zoom is too close, I want to be able to adjust the zoom but some how, it doesn't matter what zoomToWidth I passed in, the zoom is always the same.

Also, I'm not familiar with Geometry, what egs (SpatialReference.create(4326)) and wm are used for?

thanks a lot,

Thom

0 Kudos
ShellyGill1
Esri Contributor

In the sample code, the value of zoomToWidth would only change if the accuracy of the GPS location changes; if I change the factor from 50 to 200 or 10 for example, I see this reflected in the map scale when the location initially changes.  One thing that might be worth checking is that you map is initialized before you attempt to change the extent, and also make sure that your setExtent call is not conflicting with any specific zoom level or extent set when you create your MapView, maybe in the layout XML if you're using maptions in that. If you're having specific issues with setExtent not working it may be best if you started a new thread, and post some code that reproduces the specific problem.

The SpatialReference is used to project the Point from the spatial reference of the location point (WGS 84) to the map spatial reference - by default the spatial reference of the map, if using the Esri basemaps, would be WGS 1984 Web Mercator Auxiliary Sphere. You can find a list of all spatial references at these locations - this shows the codes (like 4326) along with the definition of the :

Mobile projected coordinate systems—ArcGIS Runtime SDK for Android | ArcGIS for Developers

Mobile geographic coordinate systems—ArcGIS Runtime SDK for Android | ArcGIS for Developers

If you're developing applications with spatial data but are not familiar with spatial references, coordinate systems, projections and the like, it is worth familiarising yourself with these concepts.

0 Kudos
ThomNgo
Deactivated User

Thanks Shelly,

It works, the issue was that I also used the codes below, hence the accuracy never changed.

if (location.hasAccuracy()) { 

     accuracy = location.getAccuracy(); 

}

I commented them out and set accuracy = 400;  to get the zoom scale I needed.

Now, we tested the Navigation autopan mode in Washington DC street yesterday and noticed that if 4G signal is low, the map stopped navigating and got stuck even after 4G signal was back. I had to reopen the app to get the map reinitialized in order to see it auto pan again. Is there any trick to solve this?

0 Kudos
ShellyGill1
Esri Contributor

I tried to reproduce the issue you described, leaving the map in autopan Navigation mode, and moving between signal and no-signal areas, but I found when I returned to an area of signal, and started getting location updates again, the map updated. Are you sure this is not a different case of accidentally catching the map, meanving some navigation is done and then the auto-pan mode is turned to OFF again? And does your LocationDisplayManager.LocationListener.onLocationChanged still get called with location updates? Perhaps you can add yourself a test button that checks the mode, and re-set that if it's turned to off, and also try checking the LocationDisplayManager isStarted remains true as well. If you are still finding your problem, maybe you can try stopping and re-starting the LocationDisplayManager.

0 Kudos
ThomNgo
Deactivated User

Shelly,

It could be device itself. Mine is Samsung Galaxy Note 10.1(2012 version) with Android 4.1.2. I've tried on 3-4 same devices, same thing happened. The Auto Pan got stuck, the map didn't pan while tablet moving. I tried to restart LocationDisplayManager but it still didn't work. The only way to get it to pan again is to get out and get back to the app. Also, we've tried on Samsung Galaxy Note 10.1 (2014 version) with Android 4.3, it is better. The entire trip (45 minutes on the bus) the map only get stuck once at the beginning, as compare to 2012 tablet which stucked more than 3-4 times.

Thanks a lot,

Thom

0 Kudos