Pages 1 of 1  
Forums  >> Android  >> Location issues on HTC Hero?

JManfield
Rank :User
Posts:3
Overall Rating:0
Subject:
Location issues on HTC Hero?
Date:
2009-11-04 at 07:17 PM CST

What GPS modes are supported on Android phones like HTC Hero on Sprint? Is MS-Based/MS-Assisted/AFLT supported; or is it just Autonomous?

I wrote a simple application to get locations using the Android location API on HTC Hero and here are my observations:

- In LocationManager.requestLocationUpdates, if LocationManager.NETWORK_PROVIDER is passed as the provider name, just cell sites are returned -- the lat/long was always a couple of miles off.

- LocationManager.GPS_PROVIDER works with LocationManager.requestLocationUpdates, but often gets into LocationProvider.TEMPORARILY_UNAVAILABLE state (trapped by the LocationListener onStatusChanged); and hence does not get a fix. Also, the fixes are about a block away; when the phone is indoors but by the window.

- If LocationManager.getBestProvider is to be used; what Criteria must be passed? None of the criteria values (costAllowed, powerUsage etc) returned a provider name
- The Android API docs mentions that Location.getAccuracy() returns accuracy in meters. However, lot of times I see the accuracy to be as high as 6144 (6km), while the physical location of the lat/long is much less than that (maybe 3000 ft). Is the accuracy returned reliable?

I ran the same program on HTC Magic on T-Mobile and the results were far more impressive:
- With both HTC Magic and HTC Hero adjacent to each other by the window in my office, the HTC Magic returned accurate locations; while the accuracy of HTC Hero was a block away.
- HTC Magic never got into the LocationProvider.TEMPORARILY_UNAVAILABLE state; while HTC Hero got into this state; and had trouble getting fixes
- HTC Magic has a smart GPS optimization. It wakes up the GPS chip at the notification interval time set in LocationManager.requestLocationUpdates; get locations for about 30 secs; spaced 5 secs apart; then shuts off the GPS. For example, if the notification interval is set for 5 minutes, it gets locations only every 5th minutes; and stops collecting GPS -- as indicated by the logs and the satellite icon on the phone. As result, the battery power is conserved significantly. On HTC Hero, one has to manually shutdown the location listener (LocationManager.removedUpdates(listener) to mimic the behavior; yet the GPS icon stays active on the phone.


JasonRall
Rank :User
Posts:10
Overall Rating:2
Subject:
re: Location issues on HTC Hero?
Date:
2009-11-11 at 11:55 AM CST

Sorry for the delay on this answer, I had to do some digging.

- In LocationManager.requestLocationUpdates, if LocationManager.NETWORK_PROVIDER is passed as the provider name, just cell sites are returned -- the lat/long was always a couple of miles off.
- The Android API docs mentions that Location.getAccuracy() returns accuracy in meters. However, lot of times I see the accuracy to be as high as 6144 (6km), while the physical location of the lat/long is much less than that (maybe 3000 ft). Is the accuracy returned reliable?

When you say the physical location are you going off of what the GPS reads (on the Hero/another device) compared with what is being returned by the coarse fix? If so then yes it is probably reasonably accurate in saying how inaccurate it is. The coordinates returned in the case of a network fix are the center of an ellipsoid of where you "could" be and thats not to say that you "could" be closer than the accuracy says you are to that point. The coarse fix used by android is a cellsector based fix and not an AFLT network fix, you could get a more accurate coarse location fix by using the Location services provided by our Sandbox.

- If LocationManager.getBestProvider is to be used; what Criteria must be passed? None of the criteria values (costAllowed, powerUsage etc) returned a provider name

What value are you passing into getBestProvider for enabledOnly. If your passing true, then the location provider has to be active, if you pass false then it doesn't have to be an active provider.

Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
this.txtOutput = (TextView)findViewById(R.id.textOutput);
this.locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
this.locationManager.requestLocationUpdates(
this.locationManager.getBestProvider(criteria, true),
0, // Minimum time interval between updates
0, // minimum distance interval between updates
this); // This class processes the results


- LocationManager.GPS_PROVIDER works with LocationManager.requestLocationUpdates, but often gets into LocationProvider.TEMPORARILY_UNAVAILABLE state (trapped by the LocationListener onStatusChanged); and hence does not get a fix. Also, the fixes are about a block away; when the phone is indoors but by the window.
- With both HTC Magic and HTC Hero adjacent to each other by the window in my office, the HTC Magic returned accurate locations; while the accuracy of HTC Hero was a block away.
- HTC Magic never got into the LocationProvider.TEMPORARILY_UNAVAILABLE state; while HTC Hero got into this state; and had trouble getting fixes

This I don't know for sure, I do know from experience that side by side two GPS units (of even the same model) can have widely varied accuracy but usually it corrects itself once the proper timing information has been obtained by the device. Where you are in a building, even by a window, the timing information held by the Hero might be very out of sync compared to your Magic. Your best bet is to try both in an open field/parking lot around noon and determine if the location becomes more accurate there. (more in next post)


JasonRall
Rank :User
Posts:10
Overall Rating:2
Subject:
re: Location issues on HTC Hero?
Date:
2009-11-11 at 11:55 AM CST


- HTC Magic has a smart GPS optimization. It wakes up the GPS chip at the notification interval time set in
LocationManager.requestLocationUpdates; get locations for about 30 secs; spaced 5 secs apart; then shuts off the GPS. For example, if the notification interval is set for 5 minutes, it gets locations only every 5th minutes; and stops collecting GPS -- as indicated by the logs and the satellite icon on the phone. As result, the battery power is conserved significantly. On HTC Hero, one has to manually shutdown the location listener (LocationManager.removedUpdates(listener) to mimic the behavior; yet the GPS icon stays active on the phone.

This could possibly be a bug. I will try to validate this and possibly create a bug for this.

Thanks,
ADP


JManfield
Rank :User
Posts:3
Overall Rating:0
Subject:
re: Location issues on HTC Hero?
Date:
2009-11-19 at 06:58 PM CST

Irrespective of whatever possible values (Accuracy.FINE or COURSE, powerUsage, costAllowed etc.) specifiec in the Criteria, the getBestProvider always returns "gps" as the provider name. The HTC Hero seems to get locations ok only when outdoors. The moment it is a little indoors, it does not get GPS fixes.

Doesn't the Hero support assisted fixes like the J2ME phones on Sprint? If so, what should be the criteria for assisted fixes?


Message will be posted within 2 minutes.
Pages 1 of 1