-1
我想提醒用戶請求GPS位置,然後獲取位置(lat,lng)。單擊按鈕時請求GPS位置
我想提醒用戶請求GPS位置,然後獲取位置(lat,lng)。單擊按鈕時請求GPS位置
用於GPS代碼啓用提示:您想對當前的位置是什麼
public boolean canGetLocation() {
return this.canGetLocation;
}
public void showSettingsAlert(){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
alertDialog.setTitle("GPS is settings");
alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
mContext.startActivity(intent);
}
});
alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
}
(像緯度,經度或谷歌地圖)。
首先在此處獲取Google地圖API:https://developers.google.com/maps/documentation/android-api/signup並使用它獲取您的當前位置。 – HaroldSer
你與這個問題無關。 –