我正在使用塔ID和gps获取gps位置,我可以获取当前位置并在toast中显示它我必须每五分钟自动dislpay它并在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();
}
}