19

I'm using the notification listener service in android 4.4 and I'm coming across an error that causes my app to stop getting notifications posted.

It's fairly random, but when it happens I'm seeing:

12-31 01:40:44.080  21680-21680/? W/ContextImpl﹕ Calling a method in the system process without a qualified user: 
android.app.ContextImpl.sendOrderedBroadcast:1192 
android.app.ContextImpl.sendOrderedBroadcast:1183       
android.content.ContextWrapper.sendOrderedBroadcast:390 
com.android.settings.applications.ProcessStatsDetail.checkForceStop:314 
com.android.settings.applications.ProcessStatsDetail.onResume:108

in the logs. I can even recreate this by just entering the "process stats" section of the developer tools on the phone. As soon as I select an app that uses the notification listener the puts up this warning and unbinds and destroys the service and when it recreates is it doesn't always pick up on events again.

I'm not sure why this would happen, can anyone shed any light?

Petro
  • 3,484
  • 3
  • 32
  • 59
Andrew
  • 7,548
  • 7
  • 50
  • 72
  • 1
    It'đ not caused by warning from `ContextImpl` (if you want to get rid of warning, rewrite it with `sendBroadcastAsUser` - see http://stackoverflow.com/questions/16013787/using-sendbroadcast-in-a-system-app/18224021#18224021. – pevik Jan 16 '15 at 14:23

2 Answers2

8

1) the NotificationListenerService is started by the system and the code for sendOrderedBroadcast throws a warning if it was called by the system process (here)

2) That is just a warning though. There is probably a crash somewhere else in your code. When a NotificationListenerService crashes, Android doesn't restart it unless you toggle the permission or restart your phone. Look for another crash and try either of those methods to restart it if it has. Starting it yourself will not work.

Gabe
  • 1,239
  • 1
  • 13
  • 20
  • But should that cause every other notification listener app installed on the phone to unbind and get destroyed and recreated as that's what I'm seeing. I've hunted the bug report but can't find any crash references other than that – Andrew Dec 31 '13 at 11:19
  • How would that affect other notification listeners? Either way, it's just a warning either way. I suspect your service is crashing somewhere else anyways. – Gabe Jan 01 '14 at 19:41
  • "How would that affect other notification listeners?" - it's not just my service that's getting unbound and destroyed it's every other app using the listener service. I can see the other apps written by other people also getting unbound in the logs and all stopping and restarting. That'd make me think if any of them crash they all get restarted which would sound very odd. – Andrew Jan 01 '14 at 23:07
  • Nothing about the code surrounding that warning should cause that to happen. The error must be somewhere else. – Gabe Jan 01 '14 at 23:40
0

Check your AIDL Package name, for me the Package name in client and server were mismatched. Hope it help somebody

Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154