我已经为android穿戴创建了一个通知。通知正确出来。我还在通知中添加了addAction。我有两个问题:
我不知道为什么我会得到三张幻灯片页(底部有三个点),
a. Notificaiton text
b. A black background image (second slide)
c. Add action button (third slide)
我正在尝试点击通知以打开一个无效的新意图:
以下是我尝试的代码:
Intent notificationIntent = new Intent(this, Wear.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
int notificationId = 001;
Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.backgroundwatch);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.launchericon)
.setContentTitle("Mail ME")
.setContentText("Are you in need of help?? Click or slide to request help!")
.setLargeIcon(background)
.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(background))
.addAction(R.drawable.launchericon,"Help", contentIntent);
我不确定我哪里出错了?
谢谢!
答案 0 :(得分:0)
似乎,当您使用BigPictureStyle
时,它在Android Wear上显示为3页:
.bigPicture(...)
的图片Open
行动检查哪个位图实际位于R.drawable.backgroundwatch
,因为您重新分配background
变量两次:
Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.backgroundwatch);