나는 타워 ID와 gps를 사용하여 GPS 위치를 얻고 있습니다. 현재 위치를 얻고 토스트에 표시 할 수 있습니다. 자동으로 매 5 분마다 그것을 제거해야하며, 안드로이드 장치의지도에 표시해야합니다. 아무도 도와 줄 수 있습니다. 나를. 내 코드는gps 위치를 자동으로 얻는 방법 android?
public void onClick(View arg0) {
// create class object
gps = new GPSTracker(AndroidGPSTrackingActivity.this);
// check if GPS enabled
if(gps.canGetLocation()){
double latitude = gps.getLatitude();
double longitude = gps.getLongitude();
// \n is for new line
Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
}else{
Toast.makeText(getApplicationContext(),"cant get location", 1000).show();
// GPS or Network is not enabled
// Ask user to enable GPS/network in settings
gps.showSettingsAlert();
}
}
감사를 어떻게 u는 너무 백그라운드에서 계속 실행하기 시작하면, 그 스레드 이후 모든 fivebminutes –
에 대한 배경에서이 서비스를 실행하는 저를 표시 할 수 있습니다 .. –