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

Android notification crashing #183

Closed
jmartine2 opened this issue Apr 11, 2017 · 6 comments
Closed

Android notification crashing #183

jmartine2 opened this issue Apr 11, 2017 · 6 comments
Projects
Milestone

Comments

@jmartine2
Copy link
Contributor

Two of my beta testers got new phones, running Nougat (It' the LG V20 if that matters). They are my first users to run Nougat, I believe. Since then they are producing the following unhandled exception:

android.app.RemoteServiceException: Bad notification posted from package com.elephanigma.starmygrooves: Couldn't cache contentViews: package=com.elephanigma.starmygrooves
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6247)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

Unfortunately, the stack trace does not show any of my code or MediaManager code. However, I do know that my app does not create any Android notifications on its own. The only notification is the one created by XamarinMediaManager.

Only these two beta testers are generating the crash. So, I'm thinking that it is specific to either Nougat or their phone model in particular.

Has anyone else run into this bug?

Can anyone make sense of the crash report?

FYI, I posted this on StackOverflow in February, and got no responses. It has some more details:
http://stackoverflow.com/questions/42335277/

@jmartine2
Copy link
Contributor Author

An update on this issue: I've been playing with the NotificationManager. If I comment out all of the code in UpdateNotifications(), the crash does not happen at all. With the current code, the crash happens an average of once every 5-10 songs. If I go back and uncomment everything except the following line:

nm.Notify(MediaServiceBase.NotificationId, _builder.Build());

I still get the crash occasionally, but MUCH less frequently (maybe once every 100 songs). If I then go back and comment out all the code in the method, I can't get it to happen at all.

As a workaround, I have created my own custom implementation of IMediaNotificationManager, with UpdateNotificaitons() commented out, which seems to work fine, except that the Pause button doesn't change to a Play button when paused. I worked around that by adding separate Pause and Play buttons.

This should get fixed at some point so that UpdateNotifications can work without crashing.

@LyndiLeighWK
Copy link

I have a similar issue. If I play then pause an audio file in my app, then switch to another app (like podcasts) and play an audio file from that app, my app crashes with this exception:

--- End of managed Android.Util.AndroidRuntimeException stack trace --- android.app.RemoteServiceException: Bad notification posted from package org.rbc.odb: Couldn't update remote views for: StatusBarNotification(pkg=org.rbc.odb user=UserHandle{0} id=1 tag=null key=0|org.rbc.odb|1|null|10225: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 vis=PUBLIC semFlags=0x0 semPriority=0)) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1813) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

@hig-dev
Copy link

hig-dev commented Sep 6, 2017

I'm also experiencing this problem:

android.app.RemoteServiceException: Bad notification posted from package REAL_Shuffle_Player_Forms.Android: Couldn't update remote views for: StatusBarNotification(pkg=REAL_Shuffle_Player_Forms.Android user=UserHandle{0} id=1 tag=null key=0|REAL_Shuffle_Player_Forms.Android|1|null|10210: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 vis=PUBLIC))
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1662)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:153)
	at android.app.ActivityThread.main(ActivityThread.java:6171)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
Xamarin caused by: Android.Util.AndroidRuntimeException: Bad notification posted from package REAL_Shuffle_Player_Forms.Android: Couldn't update remote views for: StatusBarNotification(pkg=REAL_Shuffle_Player_Forms.Android user=UserHandle{0} id=1 tag=null key=0|REAL_Shuffle_Player_Forms.Android|1|null|10210: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 vis=PUBLIC))
  --- End of managed Android.Util.AndroidRuntimeException stack trace ---
android.app.RemoteServiceException: Bad notification posted from package REAL_Shuffle_Player_Forms.Android: Couldn't update remote views for: StatusBarNotification(pkg=REAL_Shuffle_Player_Forms.Android user=UserHandle{0} id=1 tag=null key=0|REAL_Shuffle_Player_Forms.Android|1|null|10210: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 vis=PUBLIC))
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1662)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:153)
	at android.app.ActivityThread.main(ActivityThread.java:6171)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)

@KalpeshVedak
Copy link

KalpeshVedak commented Sep 13, 2017

We are seeing this issue too (*packagename kept hidden on purpose)

Process: *packagename, PID: 31558
android.app.RemoteServiceException: Bad notification posted from package *packagename: Couldn't update remote views for: StatusBarNotification(pkg=*packagename user=UserHandle{0} id=2534 tag=null key=0| *packagename |2534|null|10529: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 color=0xffff8205 category=transport actions=1 vis=PUBLIC semFlags=0x0 semPriority=0))
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1802)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

@KalpeshVedak
Copy link

Got a fix for my application , calling the notification update of large icon too fast leads to the problem
if you have a task that is updating notification icon and it is getting called too fast then it results in this issue
ideally large icon should only be set when the song changes and not on every action like play pause

hig-dev pushed a commit to hig-dev/XamarinMediaManager that referenced this issue Sep 16, 2017
…ption: Bad notification..), Better control of Notification art work, Fix Volume control
@hig-dev
Copy link

hig-dev commented Sep 16, 2017

I'm working on a fix in my fork https://github.com/hig-dev/XamarinMediaManager
Don't know yet if it's working fully. I will make further tests but it looks promising.
Once I tested everything, I will make a pull request.

@martijn00 martijn00 added this to To do in 1.0 via automation Aug 2, 2018
@martijn00 martijn00 added this to the 0.5 milestone Apr 2, 2019
@martijn00 martijn00 added this to To do in 0.5 via automation Apr 2, 2019
@martijn00 martijn00 removed this from To do in 1.0 Apr 2, 2019
0.5 automation moved this from To do to Done Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.5
  
Done
Development

No branches or pull requests

5 participants