Android は、gps、gsm、または wifi を使用してユーザーの位置を処理するための地理位置情報 API を提供します。これにより、ユーザーの現在の位置を特定できます。私の方法は、GPSレシーバーからの入力のみに基づいています
Geolocation API を使用して、ユーザーが特定の地理位置情報にいる時間をどのように判断できますか?
Android は、gps、gsm、または wifi を使用してユーザーの位置を処理するための地理位置情報 API を提供します。これにより、ユーザーの現在の位置を特定できます。私の方法は、GPSレシーバーからの入力のみに基づいています
Geolocation API を使用して、ユーザーが特定の地理位置情報にいる時間をどのように判断できますか?
次のようなランナブルで試してください:
private Handler handler = new Handler();
public static final int timeElapsedCheckingDelay = 100; // in ms
private float timeElapsed = 0;
private Runnable timeElapsedChecker = new Runnable()
{
public void run()
{
if(gpsActual != gpsLast) //get the last position and check
{
//You can export wherever for example a toast
timeElapsed = 0;
gpsActual = gpsLast;
}
else
timeElapsed +=0.1;
handler.removeCallbacks(timeElapsedChecker); // remove the old callback
handler.postDelayed(timeElapsedChecker, timeElapsedCheckingDelay);
}
};
これは多かれ少なかれ疑似コードであり、それがあなたに役立つことを願っています:)