ForegroundServiceStartNotAllowedException on API 31+ (v4.9.2)
Hello,
I'm experiencing a crash on Android 12+ (API 31). The crash log indicates ForegroundServiceStartNotAllowedException, even though version 4.9.2 should handle foreground service behavior correctly.
Fatal Exception: java.lang.RuntimeException
Unable to start service net.gotev.uploadservice.UploadService@a0ea1b5 with null:
android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false
Is there anything specific I need to configure to ensure proper foreground service behavior? Any guidance would be appreciated.
Thanks!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Hey,
Please look into this.
I am experiencing a crash on the Android 14 device (API 33). The issue persists, even though the latest release of this library is being used.
implementation 'net.gotev:uploadservice:4.9.4'
implementation 'net.gotev:uploadservice-okhttp:4.7.0'
Fatal Exception: java.lang.RuntimeException Unable to start service net.gotev.uploadservice.UploadService@afbdbe1 with null: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.allsoft.timemarkr/net.gotev.uploadservice.UploadService
Thanks & best regards
Hi @sunilkallsoft in which case is this crash happening? Due to behavioral changes from Android 13 onwards, certain use cases are not supportable anymore with android services, as described here: https://github.com/gotev/android-upload-service?tab=readme-ov-file#features-
I need to check whether my application executes in the supported scenario. Thank you for the guidance.
Hi there!
The ForegroundServiceStartNotAllowedException is persistent, although all the scenarios have implemented as required. The crash log points the issue at UploadService.kt class at line 227. Could you please help on this.