Nearables trigger swift example not working

Hello

I started to work with stickers, so i build first app which estimate has in the webpage, but not working as it should. It seems trigger.state is always false. i don’t know what I’m doing wrong

what is wrong??

Does the Estimote iOS app detect your sticker and its motion state? You can check that in the “Devices” section of the app—try to find your sticker on the list/radar, tap on it, and at the very bottom there’s “Nearable in motion: YES/NO.” Tap on that and check if the app reacts to the sticker’s motion.

Hi!
It reacts to moving, and still not working.

So it reacts to motion in the Estimote app, but not in your own app? That’d suggest there might be something wrong with your code. Can you share some it? Maybe I’ll be able to spot what’s wrong.

Hi!

override func viewDidLoad() {
    super.viewDidLoad()
    
    stickerLabel.text = "Welcome to first sticker app"
    
    self.triggerManager.delegate = self;

    let rule1 = ESTOrientationRule.orientationEquals(.HorizontalUpsideDown, forNearableType: .Bed)
    let rule2 = ESTMotionRule.motionStateEquals(true, forNearableIdentifier: "c8b560d6a85ad98b")

    let trigger = ESTTrigger(rules: [rule1,rule2], identifier: "mysticker")

    self.triggerManager.startMonitoringForTrigger(trigger)
 }
   
func triggerManager(manager: ESTTriggerManager, triggerChangedState trigger: ESTTrigger) {
    if (trigger.identifier == "mysticker" && trigger.state == true) {
       stickerLabel.text = "i am on your back"
    } else {
       stickerLabel.text = "Bye"
    }
}

Thanks!

So, looking at this code, you actually have two rules in there: one is that the sticker c8b560d6a85ad98b needs to be in motion, and the other one is that the “Bed” sticker must be lying upside-down. Only if these two conditions succeed at the same time, the trigger will change its state.

Thank you! I understood wrong the code. Thank you very much