ANCS attribute filtering on subtitle or message

edited May 2016 in iOS
I'm not able to get ANCS notifications for a particular string using MBLANCSNotificationAttributeIDSubtitle or MBLANCSNotificationAttributeIDMessage. I'm setting attributeData with "MyString" as in ....

MBLEvent *event = [device.ancs eventWithCategoryIds:MBLANCSCategoryIDAny
                                                   eventIds:MBLANCSEventIDNotificationAdded
                                                 eventFlags:MBLANCSEventFlagAny
                                                attributeId:MBLANCSNotificationAttributeIDSubtitle
                                              attributeData:@MyString];

[event programCommandsToRunOnEventAsync:^{
        [device.led flashLEDColorAsync:[UIColor redColor] withIntensity:1.0 numberOfFlashes:5];
        [device.hapticBuzzer startBuzzerWithPulseWidthAsync:500 completion:^{
        }];
}];

Anybody have insight on how to make this work? Does the attributeData when using MBLANCSNotificationAttributeIDSubtitle or MBLANCSNotificationAttributeIDMessage need a particular format? 

BTW, MBLANCSNotificationAttributeIDTitle works however the notification title is not what I need to filter on.

Thank you

Comments

  • Note if I create an event with MBLANCSNotificationAttributeIDTitle and add a startNotificationsWithHandlerAsync and set a breakpoint in the handler and inspect obj.data it is nil:

        [event startNotificationsWithHandlerAsync:^(MBLANCSEventData *obj, NSError *error) {

    // obj.data is nil when inspected here
            NSLog(@Cool, the data is: %@", obj);

        }];
  • I have ran into bugs with ANCS data before, and there are already a couple workarounds in the firmware.  I'll have to run some more experiments to make sure the data isn't corrupted.  I'll try to have the results early next week.

    Also, the data on MBLANCSEventData will be nil.  You'll want to use the properties specific to MBLANCSEventData (eventId, eventFlags, categoryId, categoryCount).

    Note we currently don't support reading (only matching) other ANCS data.
  • Thank you Stephen. I look forward to your results.


This discussion has been closed.