【发布时间】:2016-09-19 09:15:46
【问题描述】:
我在我的应用程序中使用通知来显示进度,并且我已经构建了一个可以为我轻松处理通知更新的类。
对于构造函数,我传递了一个上下文,以便能够构建通知。以下是更新进度通知的方法:
public void ReportProgress(int percentage, string title, string content, int icon = Resource.Drawable.Icon)
{
builder = new Notification.Builder(c)
.SetContentText(content)
.SetContentTitle(title)
.SetSmallIcon(icon)
.SetProgress(100, percentage, false)
.SetOngoing(true);
notificationManager.Notify(notificationId, builder.Build());
}
我保留相同的通知 ID,因此我可以更新现有通知,而不是创建新通知。我已经看到警告也出现在常规通知中,但随着进度的增加最为明显,因为还有更多更新。
这是警告日志:
09-19 11:49:44.754 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:44.806 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:44.863 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:44.887 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:44.940 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:44.973 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.006 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.051 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.089 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.127 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.175 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.232 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.291 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.336 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
09-19 11:49:45.372 W/IconPackHelper(17467): Unable to cache icon /data/system/theme/icons/com.App_7f020002_0.png
重要注意此警告仅在我在我的真实手机上测试时出现,这是运行 cyanogen mod 13 的 nexus 5,运行最新更新 cm-13.0-20160921-NIGHTLY,我使用了多个模拟器,但那里没有出现错误。我没有机会在另一部手机上使用 cyanoegenmod 进行测试。
每次我更新通知 (100+) 时都会出现。我怎样才能停止这个错误?为什么会这样?它应该与我有关吗?
编辑
我已经确认 IconPackHelper 是 cyanogenmod 主题服务的一部分,这里是它的来源IconCacheManagerService。
这是来自 logcat 的实际日志,它崩溃是因为它没有访问该文件的权限 (?)。
09-21 16:33:44.002: W/IconCacheManagerService(6389): Unable to cache icon com.App_7f020002_0.png
09-21 16:33:44.002: W/IconCacheManagerService(6389): java.io.FileNotFoundException: /data/system/theme/icons/com.App_7f020002_0.png: open failed: EACCES (Permission denied)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at libcore.io.IoBridge.open(IoBridge.java:452)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at org.cyanogenmod.themeservice.IconCacheManagerService$2.cacheComposedIcon(IconCacheManagerService.java:75)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at org.cyanogenmod.internal.themes.IIconCacheManager$Stub.onTransact(IIconCacheManager.java:58)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at android.os.Binder.execTransact(Binder.java:453)
09-21 16:33:44.002: W/IconCacheManagerService(6389): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at libcore.io.Posix.open(Native Method)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
09-21 16:33:44.002: W/IconCacheManagerService(6389): at libcore.io.IoBridge.open(IoBridge.java:438)
09-21 16:33:44.002: W/IconCacheManagerService(6389): ... 5 more
【问题讨论】:
-
谁是
IconPackHelper?是您的班级还是某个第 3 方库的一部分? -
我不知道IconPackHelper是什么,它不是我写的lib/类,它一定是来自操作系统的东西
标签: android notifications xamarin.android android-theme cyanogenmod