Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver android Oreo - android

Hello I am using GCM for push notification, i am getting lot of crashes on Android O
WakefulBroadcastReceiver.java line 99
android.support.v4.content.WakefulBroadcastReceiver.startWakefulService
I am not using FCM for push notification, kindly help me out to fix this issue in Android O. Following is the stacktrace of the error in fabric.
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=com.tapmad.tapmadtv cmp=com.tapmad.tapmadtv/com.google.firebase.iid.FirebaseInstanceIdService (has extras) }: app is in background uid UidRecord{b7ea475 u0a216 RCVR bg:+1m30s74ms idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3399)
at android.app.ActivityThread.-wrap18(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Related

Permission Denial : Starting Intent ( lock task mode / kiosk mode )

Any one have a suggestion how to solve this error ?
I am trying to run lock task with intent getLaunchIntentForPackage but I have no idea why this error is coming and which type of permission it wants to run this task.
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.example.videoplayer cmp=com.example.videoplayer/.MainActivity } from ProcessRecord{fd194a9 7523:com.example.lock/u0a190} (pid=7523, uid=10190) with lockTaskMode=true
at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2326)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1758)
at android.app.Activity.startActivityForResult(Activity.java:5407)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597)
at android.app.Activity.startActivity(Activity.java:5747)
at com.example.lock.MainActivity.launchApp(MainActivity.kt:110)
at com.example.lock.MainActivity.onCreate$lambda-0(MainActivity.kt:62)
at com.example.lock.MainActivity.$r8$lambda$yGvyKllS4GN5cYzDCcbSf8EdXb0(Unknown Source:0)
at com.example.lock.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7455)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1194)
at android.view.View.performClickInternal(View.java:7432)
at android.view.View.access$3700(View.java:835)
at android.view.View$PerformClick.run(View.java:28810)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
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:1003)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.SafeActivityOptions.checkPermissions(SafeActivityOptions.java:283)
at com.android.server.wm.SafeActivityOptions.getOptions(SafeActivityOptions.java:155)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1006)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:670)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1223)
I'm currently running into the same error. The only thing I can hand to you is that it can be solved by using the DevicePolicyManager.setLockTaskPackages as stated on the android site: https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode#allowlist_apps

How correct share of files android 11

I try to share of files in android 11,but i get an exception:
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.DOWNLOAD_COMPLETE flg=0x10 pkg=ru.alexanderkozlovskiy.test (has extras) } in ru.alexanderkozlovskiy.test.ActivityMain$loadReciever$1#bbd5a77
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1572)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7861)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.SecurityException: UID 10415 does not have permission to content://downloads/all_downloads/1199 [user 0] [prefix]
You can see my code on https://github.com/AlexandrKozlovskiy/share_issue. Thanks everybody for any help.

Foreground Services not working In MI phone (I'm facing error in note 5 pro)

I'm using Foreground Services for notification and it's working on other mobile phones as well it's working on an emulator also but in MI phone it's not working it shows error like this.
2020-07-01 17:47:25.783 4338-4338/com.example.notification_app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.notification_app, PID: 4338
java.lang.RuntimeException: Unable to create service com.example.notification_app.my_service: java.lang.SecurityException: Permission Denial: startForeground from pid=4338, uid=10175 requires android.permission.FOREGROUND_SERVICE
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3577)
at android.app.ActivityThread.access$1400(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1689)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.SecurityException: Permission Denial: startForeground from pid=4338, uid=10175 requires android.permission.FOREGROUND_SERVICE
at android.os.Parcel.createException(Parcel.java:1953)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:5104)
at android.app.Service.startForeground(Service.java:695)
at com.example.notification_app.my_service.startMyOwnForeground(my_service.java:57)
at com.example.notification_app.my_service.onCreate(my_service.java:44)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3565)
at android.app.ActivityThread.access$1400(ActivityThread.java:200) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1689) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:201) 
at android.app.ActivityThread.main(ActivityThread.java:6810) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) 
2020-07-01 17:47:25.826 4338-4338/? I/Process: Sending signal. PID: 4338 SIG: 9
and in line number 48, I called a function startForeground(1, new Notification());
If you read carefully in the end of second line
requires android.permission.FOREGROUND_SERVICE
I was also facing the same error in one of my project I resolve it by adding permission in the manifest file. So just simply add foreground permission in the manifest file.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"></uses-permission>
Hope it's work for you.

Why App is not able to receive GCM Notification in Android O?

I am using the GCM inside my Application. But in Android O App stops receiving notification if it goes into background. I am using StartService for Lower API 26 and StartForgroundService for upper API 26 Android devices. Also tried JobSchedular and JobIntentService but still App is getting crashed with the below error.
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.teacout.devzspoon cmp=com.teacout.devzspoon/com.devzspoon.services.MyGcmListenerService (has extras) }: app is in background uid UidRecord{cf40c05 u0a582 RCVR bg:+2m52s193ms idle change:uncached procs:1 proclist:22992, seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1600)
at android.app.ContextImpl.startService(ContextImpl.java:1546)
at android.content.ContextWrapper.startService(ContextWrapper.java:669)
at android.content.ContextWrapper.startService(ContextWrapper.java:669)
at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:99)
at com.google.android.gms.gcm.GcmReceiver.zzf(Unknown Source:23)
at com.google.android.gms.gcm.GcmReceiver.zze(Unknown Source:0)
at com.google.android.gms.gcm.GcmReceiver.onReceive(Unknown Source:106)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3406)
at android.app.ActivityThread.-wrap18(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1807) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:7000) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 
06-05 17:30:40.508 22992-22992/com.teacout.devzspoon E/UncaughtException: java.lang.RuntimeException: Unable to start receiver com.google.android.gms.gcm.GcmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.teacout.devzspoon cmp=com.teacout.devzspoon/com.devzspoon.services.MyGcmListenerService (has extras) }: app is in background uid UidRecord{cf40c05 u0a582 RCVR bg:+2m52s193ms idle change:uncached procs:1 proclist:22992, seq(0,0,0)}
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3413)
at android.app.ActivityThread.-wrap18(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1807)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver

My app integrates FCM to receive push notifications and it works okay. However, I am facing issue that on installation it crashes randomly. It is very random and occurring on OS 6.0+ devices till latest but randomly occurs.
Code wise, in service class only show notification code is written and added service in manifest.
I am getting below exception on app loads
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=com.xx.xx cmp=com.xx.xx/com.google.firebase.iid.FirebaseInstanceIdService (has extras) }: app is in background uid UidRecord{997e286 u0a92 RCVR idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3259)
at android.app.ActivityThread.-wrap17(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6540)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=com.xx.xx cmp=com.xx.xx/com.google.firebase.iid.FirebaseInstanceIdService (has extras) }: app is in background uid UidRecord{997e286 u0a92 RCVR idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1497)
at android.app.ContextImpl.startService(ContextImpl.java:1453)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:91)
at com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.zzh(Unknown Source:12)
at com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.zzb(Unknown Source:76)
at com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.onReceive(Unknown Source:28)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3252)
at android.app.ActivityThread.-wrap17(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6540)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Use this library version for firebase
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'

Categories

Resources