I\'m trying to create a notification media controller in my app using the code below which is working fine on all devices expect Huawei P8 Lite with An
Since some Huawei devices don't support MediaStyle you need to build notification without styling. I experienced this issue on this models Huawei P8 Lite and Huawei Y3II. So, check if device is huawei and SDK versions as mentioned and create a simple notification as below. This question helped me to find solution Strange allow/deny question on Huawei 5.1 phone when showing notification . Anyway, I hope helps someone
boolean isLollipopHuawei = (android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1 ||
android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) && Build.MANUFACTURER.equalsIgnoreCase("HUAWEI");
if (isLollipopHuawei) {
builder
.setContentTitle(description.getTitle())
.setContentText(contentText)
.setOngoing(true)
.setContentIntent(createContentIntent())
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(),
R.drawable.mobi_plc))
.addAction(R.drawable.ic_previous_outline_notification,
this.service.getString(R.string.next_station),
MediaButtonReceiver.buildMediaButtonPendingIntent(
this.service,
PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS))
.addAction(R.drawable.ic_next_outline_notification,
this.service.getString(R.string.next_station),
MediaButtonReceiver.buildMediaButtonPendingIntent(
this.service,
PlaybackStateCompat.ACTION_SKIP_TO_NEXT))
.setSmallIcon(R.drawable.ic_stat)
.setAutoCancel(false);
}