swift - 我想通过 BLE 设备使用 ANCS 回复 WhatsApp 通知

标签 swift notifications bluetooth-lowenergy ancs

如何回复来自 ANCS 的通知?有没有可能? 在 ANCS 的帮助下,我能够在我的 BLE 设备上获得所有通知。现在我想在 ANCS 的帮助下过滤通知类型后回复通知。

因此,如果通知属于消息或 Whatsapp 类别,那么我将通过我们的 BLE 设备发送一些静态消息。

ANCS 有可能吗?如果是那么怎么办?如果不是,那么还有其他方法可以做到这一点吗?

最佳答案

无法使用 ANCS 发送特定的文本回复通知。

如果通知包含 EventFlagPositiveAction 的值和 EventFlagNegativeAction然后设备可以使用 positive 发出执行通知操作negative值(value)。

在 iOS 8 之后设备可以使用 NotificationAttributeIDPositiveActionLabelNotificationAttributeIDNegativeActionLabel尝试检索一些描述操作的文本(例如,来电的“接听”或“拒绝”)。

来自documentation :

The actual actions performed by the NP on behalf of the NC are determined by the NP and vary depending on the iOS notification they are performed on. For example, performing a positive action on an Incoming Call notification may answer it, while performing a negative action may decline it.

The NC must neither assume nor try to guess in advance the exact action performed on an iOS Notification, because these actions are based upon information unavailable to it, as well as other factors such as the ANCS version implemented by the NP. The NP guarantees that positive and negative actions are associated with results that do not surprise the user.

我不知道蓝牙设备可以使用任何方法通过 WhatsApp 发送消息;这将需要应用程序中的特定支持。

您可以使用消息访问配置文件 (MAP) 阅读 SMS/iMessage 消息,但 iOS 设备 do not support sending messages via MAP -

22.11.4 Message Access Profile (MAP)

Every accessory that is compatible with a device and supports MAP must:

  • Support Message Notification as described in Section 4.1 of the Bluetooth Message Access Profile Specification, version 1.0.
  • Register for notifications immediately after the connection is established, as described in Section 4.5 in the Message Access Profile Specification, version 1.0.
  • Not expect the TEL property to be present in the originator VCARD (the properties N and FN will be included). See Section 3.1.3 in the Message Access Profile Specification, version 1.0.
  • Not provide a user interface for sending messages. Devices do not support sending messages using MAP.

关于swift - 我想通过 BLE 设备使用 ANCS 回复 WhatsApp 通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56448917/

相关文章:

swift - 如何表示一个忽略时间的 Date 对象?

android - 如何将图像转换为通知图标以在 Android 应用程序中使用?

javascript - 用 javascript 构建通知中心

将 SSD1306 OLED 显示屏连接到 BLE Nano

bluetooth-lowenergy - 估计到 ibeacon AVR 的距离

ios - 如何仅模糊 uitableview 滚动的部分

ios - 带数组的测验应用程序,不重复问题

swift - textFieldDidEndEditing - 文本字段有限值输入

javascript - 用户收到超过 1 个来自 Node.js 的通知

android - 在android studio中扫描ble模块(蓝牙4.0)