How can I check the current status of the GPS receiver?

前端 未结 17 1764
时光取名叫无心
时光取名叫无心 2020-11-22 08:53

How can I check the current status of the GPS receiver? I already checked the LocationListener onStatusChanged method but somehow it seems that is not working,

17条回答
  •  迷失自我
    2020-11-22 09:47

    new member so unfortunately im unable to comment or vote up, however Stephen Daye's post above was the perfect solution to the exact same problem that i've been looking for help with.

    a small alteration to the following line:

    isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
    

    to:

    isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < (GPS_UPDATE_INTERVAL * 2);
    

    basically as im building a slow paced game and my update interval is already set to 5 seconds, once the gps signal is out for 10+ seconds, thats the right time to trigger off something.

    cheers mate, spent about 10 hours trying to solve this solution before i found your post :)

提交回复
热议问题