侦听Android中的操作穿着通知

时间:2014-11-05 10:30:05

标签: android notifications listener

在Android Wear应用程序中,如何监听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);

1 个答案:

答案 0 :(得分:0)

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