Search code examples
swiftnotificationsbluetooth-lowenergyancs

I want to reply of WhatsApp notifications by using ANCS through BLE device


How can I reply to notificatoin from ANCS ? Is it possible or not ? I am able to get all notifications on my BLE Device with the help of ANCS. Now I want to reply notification after filter the type of notificatoin with the help of ANCS.

So if notifications belongs to message or Whatsapp category then I will sent some static message through our BLE Device.

Is that possible with ANCS? If yes then how ? If no then is there any other way to do this ?


Solution

  • It is not possible to send a specific, textual reply to a notification using ANCS.

    If a notification contains values for EventFlagPositiveAction and EventFlagNegativeAction then a device can issue a Perform Notification Action with either a positive or negative value.

    After iOS 8 a device can use NotificationAttributeIDPositiveActionLabel and NotificationAttributeIDNegativeActionLabel to attempt to retrieve some text that describes the actions (e.g. "Answer" or "Decline" for an incoming call).

    From the 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.

    I am not aware of any method that a Bluetooth device can use to send a message via WhatsApp; This would require specific support in the app.

    You can read SMS/iMessage messages using the Message Access Profile (MAP), but iOS devices 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.