android.app.RemoteServiceException: Bad notification posted on huawei Y6

前端 未结 1 1843
小鲜肉
小鲜肉 2021-01-24 07:25

I\'m having crashes on a specific huawei device (HUAWEI TIT-L01) running Android 5.1

I\'m not finding alot of information by using Google

stacktrace:

<         


        
1条回答
  •  清歌不尽
    2021-01-24 07:53

    Faced with same issue. It seems like some devices from Huawei doesn't support standard MediaStyle in notification. Just don't add MediaStyle if you run in Huawei.

    final Notification.Builder builder = new Notification.Builder(MyApplication.getAppContext())
        .setSmallIcon(R.drawable.logo_statusbar)
        .setLargeIcon(coverImage)
        .setContentTitle(bookTitle)
        .setContentText(author)
        .setDeleteIntent(pendingIntent);
    if (!Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("huawei")) {
       builder.setStyle(style);
    }
    final Notification build = builder.build();
    notificationManager.notify(1, build);
    

    0 讨论(0)
提交回复
热议问题