HBiSoft / HBRecorder

Lightweight screen recording Android library
MIT License
402 stars 137 forks source link

android.app.ForegroundServiceStartNotAllowedException #142

Closed hamza-mughal5593 closed 1 year ago

hamza-mughal5593 commented 1 year ago

Android 12+ Crash in service

Fatal Exception: java.lang.RuntimeException Unable to create service HbRecorder.ScreenRecordService: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service HbRecorder.ScreenRecordService android.app.ActivityThread.handleCreateService (ActivityThread.java:4847)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1068)

Caused by android.app.ForegroundServiceStartNotAllowedException Service.startForeground() not allowed due to mAllowStartForeground false: service HbRecorder.ScreenRecordService android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:54)

android.app.Service.startForeground (Service.java:733) HbRecorder.ScreenRecordService.startNotification (ScreenRecordService.java:10) HbRecorder.ScreenRecordService.onCreate (ScreenRecordService.java:10) android.app.ActivityThread.handleCreateService (ActivityThread.java:4834)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1068)

Caused by android.os.RemoteException Remote stack trace: at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1999) at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1512) at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:13162) at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:14420) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3414)

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed if no further activity occurs within the next 3 days. Thank you for your contributions.