Describe
If you run the project on the emulator with SDK34. The app was crash and stack trace was logged that it cannot start the SimpleMediaService.
To Reproduce
Steps to reproduce the behavior:
- Clone the project
- Open and build the project on emulator with SDK 34
Expected behavior
The app wouldn't be crashed.
Stack trace
FATAL EXCEPTION: main
Process: com.rcudev.simplemediaplayer, PID: 8929
java.lang.RuntimeException: Unable to start service com.rcudev.player_service.service.SimpleMediaService@ef3b84e with Intent { cmp=com.rcudev.simplemediaplayer/com.rcudev.player_service.service.SimpleMediaService }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{9817aaa 8929:com.rcudev.simplemediaplayer/u0a186} targetSDK=34
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4839)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{9817aaa 8929:com.rcudev.simplemediaplayer/u0a186} targetSDK=34
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
at android.os.Parcel.readParcelableInternal(Parcel.java:4870)
at android.os.Parcel.readParcelable(Parcel.java:4852)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3052)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6761)
at android.app.Service.startForeground(Service.java:775)
at com.rcudev.player_service.service.notification.SimpleMediaNotificationManager.startForegroundNotification(SimpleMediaNotificationManager.kt:68)
at com.rcudev.player_service.service.notification.SimpleMediaNotificationManager.startNotificationService(SimpleMediaNotificationManager.kt:40)
at com.rcudev.player_service.service.SimpleMediaService.onStartCommand(SimpleMediaService.kt:23)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4821)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Describe
If you run the project on the emulator with SDK34. The app was crash and stack trace was logged that it cannot start the
SimpleMediaService.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The app wouldn't be crashed.
Stack trace