Question: I use 7.9.3 version of your plugin. The app works fine however when startLocationTracking() is called, the app crashes. Here is my config.xml and the stacktrace of the crash:
config.xml:
?xml version="1.0"?>
<widget versionCode="1" version="1.0"
id="com.appdeveloper.appname"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gap="http://phonegap.com/ns/1.0" xmlns="http://www.w3.org/ns/widgets">
<name>BlueWallet</name>
<preference name="permissions" value="none" />
<preference name="prerendered-icon" value="true" />
<preference name="android-windowSoftInputMode" value="adjustPan" />
<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="60000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000000" />
<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="26" />
<preference name="android-build-tool" value="gradle" />
<preference name="android-buildToolsVersion" value="26.0.2" />
<plugin name="cordova-android-support-gradle-release" />
<!--<plugin name="cordova-android-play-services-gradle-release" />
<property name="java.target" value="1.7" />
<property name="java.source" value="1.7" />-->
<preference name="phonegap-version" value="cli-7.1.0" /> <!-- habilitar para generar Android package-->
<preference name='pgb-builder-version' value='1' /> <!-- habilitar para generar Android package-->
<!--<preference name="cordova-ios" version="4.5.4" />--> <!-- habilitar para generar IOS package-->
<!--<preference name="phonegap-version" value="cli-8.0.0" />--> <!-- habilitar para generar IOS package-->
<feature name="http://api.phonegap.com/1.0/network" />
<plugin name="cordova-plugin-camera" />
<plugin name="cordova-plugin-geolocation" />
<!--<plugin name="cordova-plugin-geolocation" spec="2.4.3" />-->
<plugin name="cordova-plugin-inappbrowser" />
<plugin name="cordova-plugin-splashscreen" onload="true" />
<plugin name="cordova-plugin-whitelist" />
<plugin name="cordova-plugin-ios-longpress-fix" />
<plugin name="cordova-plugin-statusbar" version="2.1.0" source="npm" onload="true" />
<plugin name="pushwoosh-cordova-plugin@7.9.3" source="npm" />
<!--<plugin name="pushwoosh-cordova-plugin@7.0.8" source="npm" />-->
<plugin name="phonegap-plugin-barcodescanner">
<param name="CAMERA_USAGE_DESCRIPTION" value="To scan barcodes." />
</plugin>
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge" platform="ios">
<string>Utilizamos la cámara para leer códigos de barras</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="overwrite"platform="ios">
<string>Utilizamos la cámara para leer códigos de barras</string>
</edit-config>
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge"platform="ios">
<string>Utilizamos tu ubicación para mostrarte sucursales cercanas y promociones</string>
</edit-config>
<!--<gap:plugin name="cordova-plugin-inapppurchase" source="npm">
</gap:plugin>
<uses-permission android:name="android.permission.BILLING" />
<uses-permission android:name="com.android.vending.BILLING" />-->
<!--<gap:plugin name="cordova-plotprojects" source="npm" version="1.x" />-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<allow-navigation href="*" />
<access origin="*" />
</widget>
2018-11-15 17:19:16.765 1871-1871/? I/GeofencerStateMachine: sendNewLocationAvailability: availability=LocationAvailability[isLocationAvailable: true]
2018-11-15 17:19:16.781 20199-20231/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
Process: com.appdeveloper.appname, PID: 20199
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalArgumentException: Error: requested job be persisted without holding RECEIVE_BOOT_COMPLETED permission.
at android.os.Parcel.createException(Parcel.java:1946)
at android.os.Parcel.readException(Parcel.java:1910)
at android.os.Parcel.readException(Parcel.java:1860)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:184)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:44)
at com.pushwoosh.location.c.b.a(Unknown Source:13)
at com.pushwoosh.location.c.b.a(Unknown Source:26)
at com.pushwoosh.location.c.e.a(Unknown Source:53)
at com.pushwoosh.location.c.a(Unknown Source:2)
at com.pushwoosh.location.network.b.a(Unknown Source:67)
at com.pushwoosh.location.network.c.process(Unknown Source:2)
at com.pushwoosh.location.network.c.a.a(Unknown Source:76)
at com.pushwoosh.location.network.b.a(Unknown Source:29)
at com.pushwoosh.location.network.GeoLocationServiceApi21$a.a(Unknown Source:20)
at com.pushwoosh.location.network.GeoLocationServiceApi21$a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.job.JobSchedulerService$JobSchedulerStub.schedule(JobSchedulerService.java:2545)
at android.app.job.IJobScheduler$Stub.onTransact(IJobScheduler.java:60)
at android.os.Binder.execTransact(Binder.java:731)
Answer: You have included RECEIVE_BOOT_COMPLETED permission in your config.xml, however it looks like runtime does not recognize it. Please check whether this permission is correctly added to generated AndroidManifest in a native Android project.
You can also try adding location permissions in the following way:
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</config-file>
</platform>
Comments
0 comments
Please sign in to leave a comment.