Open BagasNS opened 4 months ago
@BagasNS, thanks for the feedback! Could you create a PR with this information so new users also benefit from your discovery?
Sorry for the delay. I've been busy for the last month, but here we go.
@BagasNS have checked on a lower Android device, such as Android 12. It crashes the same as before and only works properly on Android 14.
I had a similar issue, that app was crashing after running for 3-5 minutes, 🤦🏾♂️ before stumbling upon this issue thread I also had to go through the android docs and changed foreground service type to location as my app is tracking user position in background, would have helped if I searched in issues first 🥲. Great work on the PR @BagasNS, @Rapsssito please merge, it will be really helpful for users.
My change:
<manifest ... >
...
+ <!-- adding this as we use android:foregroundServiceType="location" -->
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
<application ... >
...
- <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:foregroundServiceType="shortService"/>
+ <!-- adding this as we fetch location in background -->
+ <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:foregroundServiceType="location"/>
...
</application>
...
</manifest>
Also, I have checked in android 12 and android 14 working well for me in both environments without any issue. @rajkumarthirumalai can you elaborate on your issue?
@BagasNS I've tried this solution, but it's still crashing
@BagasNS I've tried this solution, but it's still crashing
can you give some code to reproduce? you can create new git repository for minimal reproduce, i'll happy to check it out
my app is crashing when im using foregroundServiceType="connectedDevice"
i struggling for over 1 day for finding this solution first i following installation step INSTALL.md everything is good, until my app is crashing after running background process for sometime (about 3-5 minutes)
here is the error
then i found this documentation from official android page that describe about
foregroundServiceType
from that documentation i simply change my
AndroidManifest.xml
from thisinto this
after that my app is running in background without crashing, i didn't tested it for long time, so i don't know its working forever or not, but it not crashing for 3-5 minutes
so i suggest to update your documentation for android to listing possible value for
foregroundServiceType
and the impact for each value.and at the end, thanks for working to build this lib, its awesome!