我正在创建一个通知,该通知具有内容单击操作,可打开我希望它打开的活动。
Intent myIntent = new Intent(this, WearRunActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.card_icon)
.setContentTitle("Running...")
.setContentText(chronometer.getText())
.setLargeIcon(BitmapFactory.decodeResource(
getResources(), R.drawable.card_background_blur))
.setAutoCancel(true)
.setOngoing(true)
.setUsesChronometer(true)
.setWhen(initialTime)
.setContentIntent(pendingIntent)
.extend(new NotificationCompat.WearableExtender()
.addAction(new NotificationCompat.Action.Builder(R.drawable.start_icon, "abrir", pendingIntent).build())
.setContentAction(0));
NotificationManagerCompat notification_manager = NotificationManagerCompat.from(this);
notification_manager.notify(1, notificationBuilder.build());
现在,我的通知有 3 个“视图”:
- 内容
- “打开”按钮
- “阻止应用程序”按钮
如何删除通知上的“打开”按钮,以便只有 2 个“视图”、内容和“阻止应用程序”?