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

App crashed due to permissions not requested for higher android version. (Ex: Android 14) #1

Open
santhosh-01 opened this issue Jul 22, 2024 · 2 comments

Comments

@santhosh-01
Copy link

FATAL EXCEPTION: main
Process: com.example.foregroundservice, PID: 27372
java.lang.RuntimeException: Unable to start service com.example.foregroundservice.MyDownloadService@e99512d with Intent { cmp=com.example.foregroundservice/.MyDownloadService }: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{a00a931 27372:com.example.foregroundservice/u0a987} targetSDK=34
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5286)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{a00a931 27372:com.example.foregroundservice/u0a987} 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:4882)
at android.os.Parcel.readParcelable(Parcel.java:4864)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3064)
at android.os.Parcel.createException(Parcel.java:3053)
at android.os.Parcel.readException(Parcel.java:3036)
at android.os.Parcel.readException(Parcel.java:2978)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
at android.app.Service.startForeground(Service.java:775)
at com.example.foregroundservice.MyDownloadService.onStartCommand(MyDownloadService.kt:37)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5268)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:230) 
at android.os.Looper.loop(Looper.java:319) 
at android.app.ActivityThread.main(ActivityThread.java:8919) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) 

@santhosh-01
Copy link
Author

To post push notification from foreground services from Android 14

https://medium.com/@domen.lanisnik/guide-to-foreground-services-on-android-9d0127dc8f9a

@santhosh-01
Copy link
Author

From android 14, forgroundServiceType attribute mandated.
So, app is getting crashed. Created a pull request with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant