Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForegroundServiceStartNotAllowedException crash #42

Open
shuvashish76 opened this issue Sep 8, 2023 · 3 comments
Open

ForegroundServiceStartNotAllowedException crash #42

shuvashish76 opened this issue Sep 8, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@shuvashish76
Copy link
Contributor

shuvashish76 commented Sep 8, 2023

Describe the bug
App crashes when play a music from another music player e.g BlackHole/VLC while DMP playing.

To Reproduce
Steps to reproduce the behavior:

  1. Play a music from FM > DMP
  2. While DMP playing the music, open BH & play a music.
  3. See error

Crash logs

FATAL EXCEPTION: main
Process: phone.vishnu.dialogmusicplayer, PID: 4109
android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service phone.vishnu.dialogmusicplayer/.MediaPlaybackService
	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
	at android.os.Parcel.readParcelable(Parcel.java:3334)
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2421)
	at android.os.Parcel.createException(Parcel.java:2410)
	at android.os.Parcel.readException(Parcel.java:2393)
	at android.os.Parcel.readException(Parcel.java:2335)
	at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7637)
	at android.app.Service.startForeground(Service.java:733)
	at phone.vishnu.dialogmusicplayer.MediaPlaybackService$a.c(SourceFile:29)
	at android.support.v4.media.session.MediaSessionCompat$a$b.onPause(SourceFile:13)
	at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1622)
	at android.os.Handler.dispatchMessage(Handler.java:111)
	at android.os.Looper.loopOnce(Looper.java:238)
	at android.os.Looper.loop(Looper.java:357)
	at android.app.ActivityThread.main(ActivityThread.java:8090)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)
Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1881)
	at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1394)
	at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:12280)
	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3473)
	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2602)

Smartphone (please complete the following information):

  • Device: Moto g71 5G
  • Andorid Version: 12
  • App Version: v2.1.0
@VishnuSanal VishnuSanal added the bug Something isn't working label Sep 8, 2023
@VishnuSanal
Copy link
Owner

@shuvashish76 have you enabled battery restrictions/some other types of background restrictions on your device when this crash occurred? 🤔

PS: I found this, but just wanted to confirm.

@shuvashish76
Copy link
Contributor Author

Everything set to default. I'm not sure.

@matterharz
Copy link

This can be solved, at least in my case, by switching the app's battery settings to "Unrestricted" (or whatever it's called in the OS and language you use). Used to be "Optimized".

OnePlus 5t, LineageOS 19.1, v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants