简体   繁体   English

以编程方式单击通知操作按钮

[英]Click notification action button programmatically

How can I click a notification action button programmatically (another application notif, not my)?如何以编程方式单击通知操作按钮(另一个应用程序通知,而不是我的)? I can click a normal button by using the button.performClick() method.我可以使用 button.performClick() 方法单击普通按钮。 I have accessibility service to listen to incoming notification (and Notification Service listener to android 5.0+), So,there is any way to do that?我有可访问性服务来监听传入的通知(以及 android 5.0+ 的通知服务监听器),那么,有什么办法可以做到吗?

For example, click Turn on battery saver or share/delete pragmatically例如,单击“打开省电模式”或“实用地共享/删除”

...

在此处输入图片说明

You need to handle this via Accessibility Service or NotificationListenerService您需要通过Accessibility ServiceNotificationListenerService处理此问题

after that when you get Notification class, you can do it by this function:之后,当您获得Notification类时,您可以通过此功能来完成:

sbn.notification.actions[0].actionIntent.send()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 清除有关操作按钮单击的通知 - Clear notification on Action Button click 按钮执行操作单击自定义通知:Android - Perform Action On Button Click in Custom Notification : Android Android 通知操作按钮单击侦听器 - Android Notification Action Button Click Listener 以编程方式单击上下文操作栏上的“完成”按钮 - Programmatically click the Done button on a Contextual Action Bar 以编程方式单击通知 - Click on the Notification programmatically 以编程方式单击Android通知 - Programmatically click on Android notification 单击Onesignal通知操作按钮启动共享意图 - Launch share intent on Onesignal notification action button click 带有按钮的通知,单击该按钮即可执行操作而不打开活动 - Notification with button that upon click take an action without opening activity 如何通过单击通知中的操作按钮执行自定义任务? - How to perform a custom task from a action button click in notification? Android推送通知 - 如何在单击单个推送通知的操作按钮时获取通知数据 - Android Push Notification - How to get notification data when you click on action button of individual push notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM