react-native-background-geolocation: BootCompletedReceiver does not work (Android)
Module does not work on app termination and phone boot (Android)
Your Environment
- Plugin version: 0.5.0-alpha.33
- Platform: Android
- OS version: 8.0
- Device manufacturer and model: Sony XA1
- React Native version: 0.55.2
- Plugin configuration options:
{
activitiesInterval: 1000,
activityType: 'Fitness',
desiredAccuracy: BackgroundGeolocation.LOW_ACCURACY,
distanceFilter: 10,
debug: false,
fastestInterval: 30000,
interval: 60000,
locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
maxLocations: 1000000,
startForeground: true,
startOnBoot: true,
stationaryRadius: 10,
stopOnTerminate: false,
stopOnStillActivity: false,
}
- Link to your project:
Context
Expected Behavior
No errors
Actual Behavior
…
Possible Fix
Tried to add the following into AndroidManifest.xml
, but does not help:
<service android:name="com.marianhello.bgloc.LocationService"/>
<receiver android:name="com.marianhello.bgloc.BootCompletedReceiver" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Debug logs
Logs from Crashalitics:
Fatal Exception: java.lang.RuntimeException
Unable to start receiver com.marianhello.bgloc.BootCompletedReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { flg=0x4 cmp=com.dvaplus.best/com.marianhello.bgloc.LocationService (has extras) }: app is in background uid UidRecord{f611f74 u0a450 RCVR idle procs:1 seq(0,0,0)}
Caused by java.lang.IllegalStateException
Not allowed to start service Intent { flg=0x4 cmp=com.dvaplus.best/com.marianhello.bgloc.LocationService (has extras) }: app is in background uid UidRecord{f611f74 u0a450 RCVR idle procs:1 seq(0,0,0)}
com.marianhello.bgloc.BootCompletedReceiver.onReceive (BootCompletedReceiver.java:51)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 19 (4 by maintainers)
@mauron85 Any ideas why this bug is occurred and how to fix it?
@priezz I’m getting the same error in Crashlytics, did you find out what is causing the problem? and how to fix that bug?
Sorry oreo README section was removed in recent commit. Since 0.6.0 only supports Oreo and later and there is no additional step to take.
I’m seeing this in production on 0.5.0-alpha.50
I believe this has been already fixed
+1, we’re seeing these crashes happen over and over for live users.
I’m also getting this error, guys. Any update on the cause?