Я использую Android 10.0 (Pixel 3a) на эмуляторе и nativescript-vue в качестве стека.
Всякий раз, когда я вызываю geolocation.enableLocationRequest()
на mounted()
или при нажатии кнопки происходит сбой приложения.
Хотя на iOS все работает нормально.
Есть идеи?
Обновление 1 - дополнительная информация
Манифестfile:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android" package="__PACKAGE__" android:versionCode="10003" android:versionName="0.0.3">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="__APILEVEL__" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.flash"/>
<application android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:usesCleartextTraffic="true" android:theme="@style/AppTheme">
<activity android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/LaunchScreenTheme"
>
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity" />
</application>
</manifest>
Это то, что я делаю по нажатию кнопки:
try {
let that = this;
geolocation.isEnabled().then(function (isEnabled) {
if (!isEnabled) {
geolocation.enableLocationRequest().then(function () {
this.watchIds.push(geolocation.watchLocation(
function (loc) {
if (loc) {
console.log("Location service: " + loc.timestamp)
that.$store.dispatch('usersStore/editUserGeo', {lat: loc.latitude, lng: loc.longitude})
that.locations.push(loc);
}
},
function (e) {
console.log("Error: " + e.message);
},
{
iosAllowsBackgroundLocationUpdates: true,
desiredAccuracy: Accuracy.high,
}));
}, function (e) {
console.log("Error: " + (e.message || e));
});
}
}, function (e) {
console.log("Error: " + (e.message || e));
});
} catch (ex) {
console.log("Error: " + ex.message);
}
Журналы устройства сразу после возникновения аварии: https://pastebin.com/VuK5nEBi