MaxDonati
MaxDonati

Reputation: 23

How to get notified when a user leaves home in the SetSDK?

I'm using the SetSDK to show users the available bike share count at their nearby station whenever they leave their home. I'm following the example available in the pod documentation but am not getting the notification. Here is my code,

SetSDK.instance.onDeparture(.home) { notification in
    // below is my code using the notification
    let bikeStationCount = getAvailableBikes(stationsNear: notification.location)
    showNotification(withCount: bikeStationCount.count, atStation: bikeStationCount.station)
}

But I'm not getting my app to show any notification, any idea what is wrong?

Upvotes: 2

Views: 33

Answers (1)

andrewxhill
andrewxhill

Reputation: 259

It looks like your code is correct. The only thing to keep in mind is that the SetSDK will learn the user's home over time, with most users it usually takes 1-2 days for it to have enough certainty to call a place Home.

Have you had a chance to let the SDK learn long enough that it is giving you notifications now?

Hey, cool use-case!

Upvotes: 1

Related Questions