Hello friends my push notification is not working on Huawei P10 Lite - Lollipop device while its work on 6.0 device here is my code please help me to fix it. Here my notification code:
public void show(){
Bitmap largeImage = BitmapFactory.decodeResource(getResources(),R.drawable.dog);
PendingIntent pausePendingIntent = PendingIntent.getBroadcast(this, 1, new Intent("music.playerforandroid.ACTION_PAUSE_MUSIC"), 0);
PendingIntent playPendingIntent = PendingIntent.getBroadcast(this, 1, new Intent("music.playerforandroid.ACTION_PLAY_MUSIC"), 0);
PendingIntent nextPendingIntent = PendingIntent.getBroadcast(this, 1, new Intent("music.playerforandroid.NEXT_PLAY_MUSIC"), 0);
PendingIntent perviousPendingIntent = PendingIntent.getBroadcast(this, 1, new Intent("music.playerforandroid.PERVIOUS_PLAY_MUSIC"), 0);
Notification channel = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID_1)
.setSmallIcon(R.drawable.ic_music)
.setContentTitle(song.getTitle())
.setContentText(song.getArtist())
.setLargeIcon(largeImage)
.addAction(R.drawable.ic_prev, "prev", perviousPendingIntent)
.addAction(R.drawable.ic_play, "play", playPendingIntent)
.addAction(R.drawable.ic_stat_name, "pause", pausePendingIntent)
.addAction(R.drawable.ic_next, "next", nextPendingIntent)
.setStyle(new android.support.v4.media.app.NotificationCompat.MediaStyle().
setShowActionsInCompactView(1, 2, 3))
.build();
mNotificationManagerCompat.notify(1, channel);
}
here is error which i get?
E/MediaPlayer: Should have subtitle controller already set
E/AndroidRuntime: FATAL EXCEPTION: main
Process: music.playerforandroid, PID: 1305
android.app.RemoteServiceException: Bad notification posted from package music.playerforandroid: Couldn't expand RemoteViews for: StatusBarNotification(pkg=music.playerforandroid user=UserHandle{0} id=1 tag=null score=0 key=0|music.playerforandroid|1|null|10117: Notification(pri=0 contentView=music.playerforandroid/0x109007f vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=4 vis=PRIVATE))
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)