程式碼在此:http://pastebin.com/FJsdudJS
這程式碼onConnected 部分一直有問題
一直要我add permission check
然後出現
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// public void requestPermissions(@NonNull String[] permissions, int requestCode)
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for Activity#requestPermissions for more details.
return;
}
但一樣不能用
標記點依樣不能換到我目前的位置....
請求大大幫忙!!
作者: corrupt003 (QQ) 2016-01-21 15:33:00
你內文的code沒寫完阿,api level 6.0以上,有些permission要動態取得。因為你的 onConnected裡用到LocationServices,所以要有location的permission。詳細請看http://goo.gl/JvPUQ8