Get GPS Status on location changed

前端 未结 3 1592
情书的邮戳
情书的邮戳 2020-12-06 23:15

I am using GPS services to derive latitude & longitude in my App. I am able to get the latitude and longitude when the signal is avialable. Once i get a fix, if i have t

3条回答
  •  孤街浪徒
    2020-12-06 23:34

    It sounds like you want to get the current location, and you want to know when a current location is unknown, so you do not try to use an old location. In that case, you can try to get the current location, and then test if it is old or not.

    long fresh=60000; // 1 minute in milliseconds
    if(System.currentTimeMillis()-location.getTime()>fresh)
        // Do something useful with location
    

提交回复
热议问题