gpt4 book ai didi

android - Android 6.0.0 上的 ti.map 权限

转载 作者:行者123 更新时间:2023-11-30 00:51:22 25 4
gpt4 key购买 nike

示例应用程序 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 包含权限 [更新]:

<?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

最佳答案

从 Android 6.0(API 级别 23)开始,用户在应用运行时向应用授予权限,而不是在安装应用时。

因此,为了从 marshmallow 设备获取位置,您需要显示系统弹出窗口以供用户请求特定权限

此链接可帮助您了解“在运行时请求权限”。 https://developer.android.com/training/permissions/requesting.html

关于android - Android 6.0.0 上的 ti.map 权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40970711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com