Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何从通知中读取内容意图_Android_Android Intent_Android Notifications_Android Notification Bar_Android Statusbar - Fatal编程技术网

Android 如何从通知中读取内容意图

Android 如何从通知中读取内容意图,android,android-intent,android-notifications,android-notification-bar,android-statusbar,Android,Android Intent,Android Notifications,Android Notification Bar,Android Statusbar,我正在使用NotificationListenerService阅读状态栏上发布的通知。我能够阅读通知上的标题和文本,但找不到阅读通知中设置的操作和内容意图的方法 在中,您可以访问。这样,您就可以分别调用并使用公共成员变量和访问内容意图和操作 @Override public void onNotificationPosted(StatusBarNotification sbn) { Notificiation notification = sbn.getNotification();

我正在使用
NotificationListenerService
阅读状态栏上发布的通知。我能够阅读通知上的标题和文本,但找不到阅读通知中设置的操作和内容意图的方法

在中,您可以访问。这样,您就可以分别调用并使用公共成员变量和访问内容意图和操作

@Override
public void onNotificationPosted(StatusBarNotification sbn) {
  Notificiation notification = sbn.getNotification();

  PendingIntent contentIntent = notification.contentIntent;
  Actions[] actions = notification.actions;
}
在中,您可以访问。这样,您就可以分别调用并使用公共成员变量和访问内容意图和操作

@Override
public void onNotificationPosted(StatusBarNotification sbn) {
  Notificiation notification = sbn.getNotification();

  PendingIntent contentIntent = notification.contentIntent;
  Actions[] actions = notification.actions;
}

谢谢如何从待定意图中获取意图。似乎
getIntent
是隐藏的,如果试图使用反射获取方法,我会遇到异常。@Libin-这是故意不可能的。从Intent到PendingIntent的转换是单向的,特别是让其他应用程序/系统无法修改该意图。我看到应用程序再次阅读通知和发布。我不知道他们是如何阅读的。当你点击这些通知时,他们可以启动意图。其中一个应用程序是未通知,你可以撤销已撤销的通知。未通知应用程序将重新发布通知,并且还可以在点击时深度链接到实际发布的应用程序。如果我们无法阅读内容意图,想知道这是如何工作的。不,PendingEvents不可持久。谢谢。如何从待定意图中获取意图。似乎
getIntent
是隐藏的,如果试图使用反射获取方法,我会遇到异常。@Libin-这是故意不可能的。从Intent到PendingIntent的转换是单向的,特别是让其他应用程序/系统无法修改该意图。我看到应用程序再次阅读通知和发布。我不知道他们是如何阅读的。当你点击这些通知时,他们可以启动意图。其中一个应用程序是未通知,你可以撤销已撤销的通知。未通知应用程序将重新发布通知,并且还可以在点击时深度链接到实际发布的应用程序。想知道如果我们无法阅读内容意图,这是如何工作的。不,PendingEntities是不持久的。