android-upload-service icon indicating copy to clipboard operation
android-upload-service copied to clipboard

ForegroundServiceStartNotAllowedException on API 31+ (v4.9.2)

Open MikolajMichalczak opened this issue 9 months ago • 5 comments

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!

MikolajMichalczak avatar Mar 03 '25 11:03 MikolajMichalczak

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.

stale[bot] avatar May 06 '25 05:05 stale[bot]

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

Image

sunilkallsoft avatar May 28 '25 05:05 sunilkallsoft

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-

gotev avatar May 28 '25 05:05 gotev

I need to check whether my application executes in the supported scenario. Thank you for the guidance.

sunilkallsoft avatar May 28 '25 06:05 sunilkallsoft

Hi there!

Image

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.

sunilkallsoft avatar Jul 02 '25 06:07 sunilkallsoft