使用GPS提示的問題是Call requires permission which may be rejected by user: code should explicitly check to s
1.在使用GPS的時候提示Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`more... (Ctrl+F1),這句話的意思是:呼叫需要的許可權可能被使用者拒絕,程式碼應該顯示地檢查許可權是否可用,用checkpermission或者顯示地處理一個潛在的SecurityException異常,這時候其實已經說明你的api使用的是23以上了,
2.我的解決辦法是新增判斷,程式碼如下:
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{}