Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java android.app.RemoteServiceException:华为Y6上发布错误通知_Java_Android_Notifications_Huawei Mobile Services - Fatal编程技术网

Java android.app.RemoteServiceException:华为Y6上发布错误通知

Java android.app.RemoteServiceException:华为Y6上发布错误通知,java,android,notifications,huawei-mobile-services,Java,Android,Notifications,Huawei Mobile Services,我在运行Android 5.1的特定华为设备(华为TIT-L01)上发生崩溃 我没有通过谷歌找到太多的信息 堆栈跟踪: android.app.RemoteServiceException: Bad notification posted from package com.myapp.test: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.myapp.test user=UserHandle{0} id=1

我在运行Android 5.1的特定华为设备(华为TIT-L01)上发生崩溃

我没有通过谷歌找到太多的信息

堆栈跟踪:

android.app.RemoteServiceException: Bad notification posted from package 
com.myapp.test: Couldn't expand RemoteViews for: 
StatusBarNotification(pkg=com.myapp.test user=UserHandle{0} 
id=1 tag=null score=0 key=0|com.myapp.test|1|null|10693: 
Notification(pri=0 contentView=com.myapp.test/0x109007e 
vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 
category=transport actions=3 vis=PRIVATE))
代码(这不是我写的,所以不要评判我):


面对同样的问题。华为的一些设备似乎不支持通知中的标准MediaStyle。如果您在华为运行,请不要添加
MediaStyle

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);

面对同样的问题。华为的一些设备似乎不支持通知中的标准MediaStyle。如果您在华为运行,请不要添加
MediaStyle

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);

您确定此代码正在触发该异常吗?我看不到您在哪里使用
remoteview
。我很确定。MediaStyle确定通知的视图层次结构在Android中的通知$MediaStyle中,有几个方法返回RemoteViews对象。我猜是在makeMediaContentView方法中,我在同一台设备上遇到了相同的问题!这似乎是由MediaStyle引起的,但我还没有找到解决办法。你并不孤单!谢谢,如果你有什么新发现,请告诉我!您确定此代码正在触发该异常吗?我看不到您在哪里使用
remoteview
。我很确定。MediaStyle确定通知的视图层次结构在Android中的通知$MediaStyle中,有几个方法返回RemoteViews对象。我猜是在makeMediaContentView方法中,我在同一台设备上遇到了相同的问题!这似乎是由MediaStyle引起的,但我还没有找到解决办法。你并不孤单!谢谢,如果你有什么新发现,请告诉我!这对我来说是可行的,但出于某种原因,它会在通知上显示一条消息,询问我是否允许应用程序推送通知消息,你以前见过吗@casolorz可能是华为特定的用户界面。也许他们已经实现了更多的通知层,要求用户允许来自特定应用程序的通知。这与推送消息(例如谷歌推送消息)不同。不幸的是,我没有任何华为设备来测试它。是的,这是我的想法,只是找不到任何关于它的东西。这对我来说是可行的,但出于某种原因,它会在通知上显示一条消息,问我是否允许应用程序推送通知消息,你以前见过吗@casolorz可能是华为特定的用户界面。也许他们已经实现了更多的通知层,要求用户允许来自特定应用程序的通知。这与推送消息(例如谷歌推送消息)不同。不幸的是,我没有任何华为设备来测试它。是的,这是我的想法,只是找不到任何关于它的东西。