Android 6.0.0上的ti.map权限

时间:2016-12-05 09:14:11

标签: android titanium appcelerator appcelerator-titanium

示例应用 https://github.com/appcelerator-developer-relations/appc-sample-geocoder 由于缺少权限而在初始启动时崩溃。我无法弄清楚如何防止这种行为。有任何想法吗?授予权限后,后续启动即可。

[ERROR] TiApplication: (main) [704,705] Sending event: exception on thread: main msg:java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION; Titanium 6.0.0,2016/11/13 01:23,undefined
[ERROR] TiApplication: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
[ERROR] TiApplication:  at maps.ad.t.c(Unknown Source)
[ERROR] TiApplication:  at xj.onTransact(:com.google.android.gms.DynamiteModulesB:274)
[ERROR] TiApplication:  at android.os.Binder.transact(Binder.java:387)
[ERROR] TiApplication:  at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.setMyLocationEnabled(Unknown Source)
[ERROR] TiApplication:  at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(Unknown Source)
[ERROR] TiApplication:  at ti.map.TiUIMapView.setUserLocationEnabled(TiUIMapView.java:281)
[ERROR] TiApplication:  at ti.map.TiUIMapView.processMapProperties(TiUIMapView.java:190)
[ERROR] TiApplication:  at ti.map.TiUIMapView.onMapReady(TiUIMapView.java:162)
[ERROR] TiApplication:  at com.google.android.gms.maps.SupportMapFragment$zza$1.zza(Unknown Source)
[ERROR] TiApplication:  at com.google.android.gms.maps.internal.zzt$zza.onTransact(Unknown Source)
[ERROR] TiApplication:  at android.os.Binder.transact(Binder.java:387)
[ERROR] TiApplication:  at zu.a(:com.google.android.gms.DynamiteModulesB:82)
[ERROR] TiApplication:  at maps.ad.t$5.run(Unknown Source)
[ERROR] TiApplication:  at android.os.Handler.handleCallback(Handler.java:739)
[ERROR] TiApplication:  at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] TiApplication:  at android.os.Looper.loop(Looper.java:158)
[ERROR] TiApplication:  at android.app.ActivityThread.main(ActivityThread.java:7231)
[ERROR] TiApplication:  at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiApplication:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
[ERROR] TiApplication:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
[ERROR] AndroidRuntime: FATAL EXCEPTION: main

生成的AndroidManifest.xml包含权限[UPDATE]:

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.appcelerator.sample.mapping" android:versionCode="1" android:versionName="2.0.0">
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
    <application android:icon="@drawable/appicon" android:label="Geocoder" android:name="GeocoderApplication" android:debuggable="false" android:theme="@style/appcelerator">
        <activity android:name=".GeocoderActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name="org.appcelerator.titanium.TiActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
        <activity android:name="org.appcelerator.titanium.TiTranslucentActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/Theme.AppCompat.Translucent"/>
        <activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:configChanges="screenSize"/>
        <service android:name="com.appcelerator.aps.APSAnalyticsService" android:exported="false"/>
        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBDuTWLdPRaKN2eTTQKVc-QDNdCS6RxzPM"/>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
    </application>
    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    <permission android:name="com.appcelerator.sample.mapping.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="com.appcelerator.sample.mapping.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
</manifest>

Titanium 6.0.0.GA,设备上的Android版本:6.0.1

1 个答案:

答案 0 :(得分:0)

&LT; uses-permission android:name =“android.permission.ACCESS_WIFI_STATE”/&gt;

&LT; uses-permission android:name =“android.permission.ACCESS_NETWORK_STATE”/&gt;

&LT; uses-permission android:name =“android.permission.ACCESS_FINE_LOCATION”/&gt;

在Manifiest中添加这些权限