【问题标题】:Sending a PendingIntent to activity?向活动发送 PendingIntent?
【发布时间】:2016-01-14 18:44:10
【问题描述】:

我正在尝试使用 NotificationListenerService 监控此应用的通知。我想捕获与其通知关联的 PendingIntent 并将其发送到另一个活动。这个活动显示了一个简单的按钮来启动这个捕获的pendingIntent。我应该如何跨活动传输这个捕获的 PendingIntent?

@Override
public void onNotificationPosted(StatusBarNotification sbn) {
    super.onNotificationPosted(sbn);

    PendingIntent notiPendingIntent = sbn.getNotification().contentIntent;
}

【问题讨论】:

    标签: android android-intent notifications


    【解决方案1】:

    了解如何做到这一点。非常简单:只需使用putExtra() 将其设置为Parcelable

    【讨论】:

      猜你喜欢
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-02
      • 1970-01-01
      相关资源
      最近更新 更多