android P使用google接口进行定位

公司没有申请 google认证,但是又要做海外生意,如此一来,海外客户在不知情的情况下进行开发,肯定要用到google接口。
为了不暴露,就必须在灰色地带游走,目前方案是暂时集成了基本的google框架,但是只能个人用户激活,才能正常使用部分功能。

How to get GMS apps from GAPPs and integrate them into AOSP

请参考:
How_to_get_GMS_apps_from_GAPPs_and_integrate_them_into_AOSP.pdf
Integrate_gapps_for_Android9.0_klein_20181219.pdf

microg GmsCore

请参考:
https://github.com/microg/android_packages_apps_UnifiedNlp/
这个方法同事在android L上成功过,将NetworkLocation.apk编译进系统即可进行网络定位,但是在android P上,我怎么试都不成功

高通支持

这个很奇怪,我什么都没有修改,但是询问QC之后打开log就成功了。
记录一下
提case给QC,获得支持的文档
80-p9024-3_c_qualcomm®_nlp_integration_guidance_for_android_p_and_q_platforms.pdf

Created By: Duan Jianjun (12/30/2019 12:02 AM)
Hi QC,

我创建了一个local.prop并push到/data/下

启动定位时的log
12-30 07:49:10.649 D/MainActivity( 6479): network provider is enable = true
定位到的log
12-30 07:59:48.324 E/MainActivity( 6479): 打印经纬度: longitude:121.4191312 latitude:31.1904834精确位置29.818海拔43.79999923706055

thanks
----------
Created By: Helen Xu (12/29/2019 9:55 PM)
Dear customer,
please check the following and capture one new log

Add the following lines in /data/local.prop. if not exist,please create one:
log.tag.OsAgent=VERBOSE
log.tag.IzatProvider_fused=VERBOSE
log.tag.NpProxy=VERBOSE
log.tag.LocationManagerService=VERBOSE
log.tag.Gnsslocationprovider=VERBOSE
log.tag.IZatManager=VERBOSE
log.tag.IzatService=VERBOSE
log.tag.IzatSvc_IzatManager=VERBOSE
log.tag.IzatSvc_OSNPProxy=VERBOSE
log.tag.LocationProviderProxy-network=VERBOSE
log.tag.IzatProvider-network=VERBOSE
3. Change access permission to rw
------- adb shell chmod 660 /data/local.prop
----------
Created By: Duan Jianjun (12/29/2019 8:08 PM)
Hi QC,

虽然定位成功了,但是有一个很严重的问题:

恢复出厂设置,再进行定位,网络定位需要20分钟才能成功,请问如何解释?

thanks
----------
Created By: Duan Jianjun (12/29/2019 6:43 PM)
Hi QC,

成功了!
可是我什么都没有做!!!很奇怪

根据文档80-P9024-31.4.3小节
(1)
adb shell getprop ro.location.osnlp.package
com.google.android.gms
adb shell getprop ro.location.osnlp.region.package
以上两个值为平台默认,没有修改

(2)
adb shell cat vendor/etc/izat.conf
没有参数OSNLP_PACKAGE和REGION_OSNLP_PACKAGE
因为:
#########################################
# NLP PACKAGE SETTINGS
#########################################
# OSNLP_PACKAGE has been deprecated and replaced
# by system property ro.location.osnlp.package
# REGION_OSNLP_PACKAGE has been deprecated and
# replaced by system property ro.location.osnlp.region.package3)
################################
# NLP Settings
################################
# NLP_MODE 1: OSNLP Only, 2: QNP Only, 3: Combo, 4: QNP preferred
# For Automotive products, please use NLP_MODE = 4 only.
# NLP_TOLERANCE_TIME_FIRST: Time in ms used in Combo mode
# to determine how much Tolerance for first position
# NLP_TOLERANCE_TIME_AFTER: Time in ms used in Combo mode
# to determine how much Tolerance for positions after first
# NLP_THRESHOLD: Sets how many failures needed before
# switching preferred NLP in Combo mode
# NLP_ACCURACY_MULTIPLE: Determines how far off the accuracy
# must be, in multiples, between two NLP location reports to
# be considered much worse accuracy. Used in switching logic
# NLP COMBO MODE USES QNP WITH NO EULA CONSENT: Determines
# whether or not to still send network location requests to
# QNP when the EULA is not consented to by the user. QNP can
# still return ZPP locations or injected locations even
# without EULA consent, but the uncertainty can be high.
# QNP preferred mode prefers QNP when there is EULA consent,
# otherwise OSNLP is used.
NLP_MODE = 4
NLP_MODE_EMERGENCY = 2
NLP_TOLERANCE_TIME_FIRST = 5000
NLP_TOLERANCE_TIME_AFTER = 20000
NLP_THRESHOLD = 3
NLP_ACCURACY_MULTIPLE = 2
NLP_COMBO_MODE_USES_QNP_WITH_NO_EULA_CONSENT = 14)
将/vendor/etc/gps.conf中的Debug_LEVEL = 5,log见附件
没有找到/data/local.prop文件

thanks
----------
Created By: Helen Xu (12/27/2019 2:08 AM)
Dear customer,
if network location could not work according to the configuation from doc 80-P9024-3, please capture one detailed log according to following steps:

1. Set Debug_LEVEL = 5 in /etc/gps.conf.
2. Add the following lines in /data/local.prop.
log.tag.OsAgent=VERBOSE
log.tag.IzatProvider_fused=VERBOSE
log.tag.NpProxy=VERBOSE
log.tag.LocationManagerService=VERBOSE
log.tag.Gnsslocationprovider=VERBOSE
log.tag.IZatManager=VERBOSE
log.tag.IzatService=VERBOSE
log.tag.IzatSvc_IzatManager=VERBOSE
log.tag.IzatSvc_OSNPProxy=VERBOSE
log.tag.LocationProviderProxy-network=VERBOSE
log.tag.IzatProvider-network=VERBOSE
3. Change access permission to rw
------- adb shell chmod 660 /data/local.prop

thanks
----------
Created By: Helen Xu (12/27/2019 2:02 AM)
Dear customer,
because your device is used oversea, please use google and refer to doc 80-P9024-3
QUALCOMM® NLP INTEGRATION GUIDANCE FOR ANDROID P AND Q PLATFORMS to configure.

refer another doc : 80-YA517-2 Android Pie – Qualcomm Location Update for you to check your configure.

thanks
----------
Created By: Duan Jianjun (12/27/2019 1:24 AM)
Hi QC,

1.80-NK218-2查找不到,只查到了80-NK218-1

2.海外环境能用google,无法使用baidu,com.google.android.gms能否适配使之正常使用

3.在android L上已经实现了,通过整合基本的google框架,再添加NetworkLocation.apk,网络定位正常。
现在用同样的方法在android P上无法定位成功

4.80-P9024-3
QUALCOMM® NLP INTEGRATION GUIDANCE FOR ANDROID P AND Q PLATFORMS
根据android P的文档查看设备得到:
ro.location.osnlp.package=com.google.android.gms
NLP_MODE = 4
如何在这个前提下使用网络定位
----------
Created By: Helen Xu (12/26/2019 11:36 PM)
Dear customer,
for this feature, you need to integrate third party NLP like Baidu or NaviAuto. 

Please refer to documents in below for more details. 
1. 80-P9024-1 Rev. C-Qualcomm® NLP Integration Guidance for Android N 
2. 80-P6319-2 B-Baidu FLP and NLP Integration Guidance for Android M 
3. 80-P6319-1 B-AutoNavi FLP and NLP Integration Guidance for Android M 
4. 80-NK218-2 Rev. A_GTP Device Configuration for China Market Devices 


thanks

自己瞎改的代码

上一部分我说没有修改过,询问QC之后编译一个版本就好了,但是其实也有改动,不过都是参考microg GmsCore还有网上杂七杂八的解答修改的,为了同步代码状态,生成一个patch记录一下:

Index: frameworks/base/core/res/res/values/config.xml
===================================================================
--- frameworks/base/core/res/res/values/config.xml	(版本 2846)
+++ frameworks/base/core/res/res/values/config.xml	(工作副本)
@@ -1718,6 +1718,8 @@
     <string-array name="config_locationProviderPackageNames" translatable="false">
         <!-- The standard AOSP fused location provider -->
         <item>com.android.location.fused</item>
+        <item>com.google.android.gms</item>
     </string-array>
 
     <!-- This string array can be overriden to enable test location providers initially. -->
Index: frameworks/base/packages/SettingsProvider/res/values/defaults.xml
===================================================================
--- frameworks/base/packages/SettingsProvider/res/values/defaults.xml	(版本 2846)
+++ frameworks/base/packages/SettingsProvider/res/values/defaults.xml	(工作副本)
@@ -46,7 +46,7 @@
          Network location is off by default because it requires
          user opt-in via Setup Wizard or Settings.
     -->
-    <string name="def_location_providers_allowed" translatable="false">gps</string>
+    <string name="def_location_providers_allowed" translatable="false">gps,network</string>
     <bool name="assisted_gps_enabled">true</bool>
     <bool name="def_netstats_enabled">true</bool>
     <bool name="def_usb_mass_storage_enabled">true</bool>

之后通过高通确认,这部分上层代码也是要修改的,相当于overlay了底层的值。

最后注意,
网络定位需要在设置中打开Google Location Accuracy
Settings - Security & location - Location - Google Location Accuracy - switch on
并且关闭高通的定位
Settings - Security & location - Location - Accelerated Location - DISAGREE

第一次网络定位需要30秒~3分钟不等,怀疑和网络环境有关。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值