質問

Is there a way to find out that the GPS signal is lost? I am not talking about whether GPS Module is enabled/disabled. Suppose that GPS Module is enabled; but fix is lost?

This How can I check the current status of the GPS receiver? link is not useful; since you cannot use that solution in the case which user is stationary for a certain period of time("LocationListener" stops listening to location updates; after you receive couple of updates upon first fix).

More than that, unlike on gingerbread, on my Nexus 4(which has Jelly Bean 4.2.2) "onStatusChanged" method of "LocationListener" is not called anymore! I dont know whether it depends on being stationary or not; yet it doesn't mean anything for me again.

On the other hand, My API is compiled via API 10, however in that release, no action called "GPS_FIX_CHANGE" had been declared in "LocationManager" class at that time.

What should i do to have my app notified of signal lost and gained events?

Kind Regards

役に立ちましたか?

解決

Android and iphone both have a stand still filter enabled, which as you described, leads to the situation that you don't get a location update when standing still.
I would just ignore that, and use the Location.accuracy value for each new location received. If that values exceeds 30m then it is bad GPS.

While standing you could decide to do nothing.
Theoretically there is a solution for your task, but with drawbacks:
When you don't get a new location for some time, you can disable and reenable Location Service every 5 seconds. Then in case of good GPS you get a new coordinate, or none if there is no GPS signal available.

他のヒント

I've encountered this same issue and came to this conclusion: when the GPS signal is lost the listener will return the last value or 0.0 (in some situations). If the last 2 values are equal to the last 5th decimal then the signal is lost. In practice the GPS will never give you two consecutive coordinates with the same value. It's close to impossible, so just consider this case if(last_coords == new_coords) -> GPS signal lost.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top