作者robust083 (暖男葛葛)
看板AndroidDev
标题[问题] google Map的问题
时间Thu Jan 21 15:19:42 2016
程式码在此:
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;
}
但一样不能用
标记点依样不能换到我目前的位置....
请求大大帮忙!!
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 39.12.152.101
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1453360785.A.439.html
1F:→ corrupt003: 你内文的code没写完阿,api level 6.0以上,有些permi 01/21 15:33
2F:→ corrupt003: ssion要动态取得。因为你的 onConnected里用到Locatio 01/21 15:33
3F:→ corrupt003: nServices,所以要有location的permission。详细请看h 01/21 15:33
4F:→ corrupt003: ttp://goo.gl/JvPUQ8 01/21 15:33
5F:→ robust083: 有办法不要增加那行吗 = = 因为同学就不用增加那程式 01/21 15:44
6F:推 z0furu: 不用增加会不会是因为没有把SDK支援到6.0? 01/21 15:47
7F:→ robust083: 解决了 好像是没支援到6.0.. 但又没办法抓到GPS了:(( 01/21 16:21