2017-07-28 91 views
1

我試圖使用GoogleMap來創建地圖應用程序來獲取位置座標和反向地理編碼。我試圖在聯想A7000plus上運行它,它運行正常,沒有任何問題。Android GoogleMaps無法在某些設備上使用顯示java.lang.SecurityException:需要INSTALL_LOCATION_PROVIDER權限

不知何故,我測試我的應用程序到一些小米與同一個Android棉花糖,地圖不工作。只有這樣的錯誤報告:

07-28 14:04:01.144 19465-19465/? E/NetworkLocationProvider: Exception 
                  java.lang.SecurityException: need INSTALL_LOCATION_PROVIDER permission, or UID of a currently bound location provider 
                   at android.os.Parcel.readException(Parcel.java:1620) 
                   at android.os.Parcel.readException(Parcel.java:1573) 
                   at android.location.ILocationManager$Stub$Proxy.reportLocation(ILocationManager.java:1281) 
                   at com.android.location.provider.LocationProviderBase.reportLocation(LocationProviderBase.java:136) 
                   at com.amap.android.location.v.handleMessage(Unknown Source) 
                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                   at android.os.Looper.loop(Looper.java:148) 
                   at android.app.ActivityThread.main(ActivityThread.java:5441) 
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 
07-28 14:04:01.164 19465-19465/? E/NetworkLocationProvider: Exception 
                  java.lang.SecurityException: need INSTALL_LOCATION_PROVIDER permission, or UID of a currently bound location provider 
                   at android.os.Parcel.readException(Parcel.java:1620) 
                   at android.os.Parcel.readException(Parcel.java:1573) 
                   at android.location.ILocationManager$Stub$Proxy.reportLocation(ILocationManager.java:1281) 
                   at com.android.location.provider.LocationProviderBase.reportLocation(LocationProviderBase.java:136) 
                   at com.amap.android.location.v.handleMessage(Unknown Source) 
                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                   at android.os.Looper.loop(Looper.java:148) 
                   at android.app.ActivityThread.main(ActivityThread.java:5441) 
                   at java.lang.reflect.Method.invoke(Native Method) 
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 

而且,這裏是我實現艙單

<uses-sdk android:minSdkVersion="14" /> 

<permission 
    android:name="com.myapps.permission.MAPS_RECEIVE" 
    android:protectionLevel="signature" /> 

<uses-permission android:name="com.myapps.permission.MAPS_RECEIVE" /> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.CAMERA" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

<uses-feature android:name="android.hardware.camera" /> 
<uses-feature android:name="android.hardware.camera.autofocus" /> 
<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true" /> 

你能幫助我如何解決這個問題呢?

**編輯:**我已將該運行時權限放在我的代碼上,因爲我使用的所有手機,包括Lenovo A7000都是棉花糖。但不知何故,它不會在小米手機與Android版本相同

回答

1

您必須詢問運行時權限才能訪問位置數據。自Android 6.0發佈以來,用戶在運行時授予應用程序權限。這個link解釋了運行時權限。

相關問題