How to Fix: Android.App.Remoteserviceexception: Bad Notification Posted from Package *: Couldn't Create Icon: Statusbaricon

How to fix: android.app.RemoteServiceException: Bad notification posted from package *: Couldn't create icon: StatusBarIcon

What was happening was, I was including the integer reference to the icon in the PendingIntent bundle, and that integer was later being referenced while being posted to the NotificationManager.

In between getting the integer reference and the pending intent going off, the app was updated and all of the drawable references changed. The integer that used to reference the correct drawable now referenced either the incorrect drawable or none at all (none at all - causing this crash)

android.app.RemoteServiceException: Bad notification posted from package

I would suggest remove all the background ripple and foreground ripples from the layout and to keep the ripple in the notification.

In your notifications layout.

<ImageButton
android:id="@+id/notification_base_previous"
style="@style/NotificationAction.Previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

Now declare the style in the manifest.

This is for your individual buttons.

 <style name="NotificationAction.Previous" parent="@style/NotificationAction">
<item name="android:src">@drawable/btn_playback_previous_light</item>
</style>

This should be the parent of style.

<style name="NotificationAction">
<item name="android:layout_width">@dimen/notification_action_width</item>
<item name="android:layout_height">@dimen/notification_action_height</item>
<item name="android:gravity">center|right</item>
<item name="android:scaleType">fitCenter</item>
<item name="android:padding">@dimen/notification_action_padding</item>
<item name="android:background">?android:selectableItemBackground</item>
</style>

It works this all the devices I have used so far. Please have a look.



Related Topics



Leave a reply



Submit