Android佩戴通知中操作的侦听器



在Android穿戴应用程序中,如何监听Notification中的操作。在我的情况下,我在通知中有批准按钮和拒绝按钮。如果动作被窃听,如何收听。

NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
        .setSmallIcon(R.drawable.sf)
        .setContentTitle("John David")
        .setContentText("Quote approval")
        .setContentIntent(viewPendingIntent)
        .setLargeIcon(BitmapFactory.decodeResource(
                getResources(), R.drawable.prof))
        .addAction(R.drawable.generic_confirmation_00170,
                getString(R.string.agree), mapPendingIntent)
        .addAction(R.drawable.ic_full_cancel,
                getString(R.string.disagree), mapPendingIntent);

首选以下示例代码http://developer.android.com/samples/index.html并检查方法buildNotification

最新更新