2016-11-11 73 views

回答

0

用於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(); 
    } 

(像緯度,經度或谷歌地圖)。