CTA-敏感行为-定位(重点)
1 需求
2 权限
3 接口
4 示例
5 adb命令
6.1 验证
adb shell dumpsys appops --op 0/1/2
6.2 验证
adb shell dumpsys location
6.3 验证
adb logcat -b main | findstr "LocationManagerService:.onRegistrationAdded"
7 参考资料
Android源码
- 国内:
- AndroidXRef(1.6-9.0)
- AOSPXRef(7.1-12.0)
- 海外:
Android文档
- 国内
- 海外
Android权限
- Manifest.permission | Android Developers
- http://androidxref.com/8.0.0_r4/xref/frameworks/base/core/res/AndroidManifest.xml
参考资料:
构建位置感知应用 | Android 开发者 | Android Developers
android的四种定位方式_lqxandroid2012的专栏-CSDN博客
Android 定位服务(Location-Based Services)_yhao的博客-CSDN博客_passive_provider
Android中使用GPS和NetWork获取定位信息_Widsom的博客-CSDN博客_android network_provider
android中几种定位方式详解_BennuCTech的博客-CSDN博客_android 定位
- 定位 分类
- 定位原理:GPS、AGPS、NETWORK、WLAN
- GPS定位(GPS_PROVIDER)
- 网络定位(NETWORK_PROVIDER)
- 被动定位(PASSIVE_PROVIDER)
- 融合定位(FUSED_PROVIDER)
- 精准程度:确切位置(precise location)、大致位置(approximate location)
- 后台:前台定位(foreground location)、后台定位(background location)
- 定位原理:GPS、AGPS、NETWORK、WLAN
Android 存储用例和最佳做法 | Android 开发者 | Android Developers
AndroidManifest.xml - OpenGrok cross reference for /frameworks/base/core/res/AndroidManifest.xml
976 <!-- Allows an application to access any geographic locations persisted in the 977 user's shared collection. 978 <p>Protection level: dangerous --> 979 <permission android:name="android.permission.ACCESS_MEDIA_LOCATION" 980 android:permissionGroup="android.permission-group.UNDEFINED" 981 android:label="@string/permlab_mediaLocation" 982 android:description="@string/permdesc_mediaLocation" 983 android:protectionLevel="dangerous" />
enums.proto - OpenGrok cross reference for /frameworks/proto_logging/stats/enums/app/enums.proto
APP_OP_ACCESS_MEDIA_LOCATION = 90;
权限 & 接口 汇总
- android.permission.ACCESS_COARSE_LOCATION
- android.permission.ACCESS_FINE_LOCATION
定位 权限
- android.permission.ACCESS_COARSE_LOCATION
- android.permission.ACCESS_FINE_LOCATION
Manifest.permission | Android Developers
AndroidManifest.xml - OpenGrok cross reference for /frameworks/base/core/res/AndroidManifest.xml
定位 接口
- ……
用途X:获取手机应用定位信息
adb shell dumpsys appops --op X
- APP_OP_COARSE_LOCATION = 0
- APP_OP_FINE_LOCATION = 1
- APP_OP_MONITOR_LOCATION = 41
- APP_OP_MONITOR_HIGH_POWER_LOCATION = 42
- APP_OP_MOCK_LOCATION = 58
- APP_OP_ACCESS_MEDIA_LOCATION = 90
- APP_OP_FINE_LOCATION_SOURCE = 108
- APP_OP_COARSE_LOCATION_SOURCE = 109
用途X:获取手机应用定位信息
adb shell dumpsys location