get current position location android

前端 未结 3 1465
小蘑菇
小蘑菇 2020-12-10 20:17

Location.java

package com.localisation;

import java.io.IOException;
import java.util.List;

import android.app.Activity;
import android.app.AlertDialog;
imp         


        
3条回答
  •  遥遥无期
    2020-12-10 20:51

    I'm not sure if you are asking in general, "how do I get the gps location?" or more specific "what's wrong with this code".

    If its general- this appears in How do I get the current GPS location programmatically in Android?. Also, I suggest you be careful with the getLastKnownLocation method. The last location can be horribly out of date. I also suggest you start polling gps before you actually need it, it can sometimes take a few seconds (or more) to get your first gps reading.

    If its specific- maybe explain what problems you're having?

提交回复
热议问题