Galaxy Watch(Tizen)上的通知不显示图标
我有简单的应用程序发送通知,我想在三星观看(Active 2)上显示。该通知本身已显示在手表上,但我无法显示图标。这是Gmail和我的应用程序的通知示例。在Gmail(左)上,您可以看到该应用的图标,而在右边,您无法看到。我想念什么?
我使用的相关代码如下:
int notificationId = 001;
Bitmap bIcon = BitmapFactory.decodeResource( getResources(),R.drawable.ic_stat_ic_notification);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_stat_ic_notification)
.setLargeIcon(bIcon)
.setContentTitle(title)
.setContentText(message)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationCompat.WearableExtender wearableExtender =
new NotificationCompat.WearableExtender().setContentAction(0);
notificationBuilder.extend(wearableExtender);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId,
"Home Notifier", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
}
notificationManager.notify(notificationId /* ID of notification */, notificationBuilder.build());
I have simple application that sends notifications, which I want to show on Samsung Watch (Active 2). The notification itself is shown on watch, but I cannot get Icon to be displayed. Here is example of notification from gmail and from my app. On gmail (left) you can see icon of the app, while on the right you cannot. What am I missing?
Relevant code I use is below:
int notificationId = 001;
Bitmap bIcon = BitmapFactory.decodeResource( getResources(),R.drawable.ic_stat_ic_notification);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_stat_ic_notification)
.setLargeIcon(bIcon)
.setContentTitle(title)
.setContentText(message)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationCompat.WearableExtender wearableExtender =
new NotificationCompat.WearableExtender().setContentAction(0);
notificationBuilder.extend(wearableExtender);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId,
"Home Notifier", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
}
notificationManager.notify(notificationId /* ID of notification */, notificationBuilder.build());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论