Devfly
Devfly

Reputation: 2495

iOS Reminders app can set reminders based on a particular date

if I choose the default Reminders app to remind me something on a day (for example Feb-10) AND at a location it says something like "On Feb-10 your location based reminder will be active".

So it can setup a location based reminder even in the background, on a particular date?

This is really interesting, and I want to know how is this possible, is there some trick or it's just because Apple give unlimited power to their stock apps?

P.S - I already know how to setup location-based reminders.

Upvotes: 1

Views: 715

Answers (1)

Srikar Appalaraju
Srikar Appalaraju

Reputation: 73618

Its no big deal. This techniques is called GeoFencing. You can do it too. Apple Location framework provides some interesting APIs for this purpose.

Try to use the

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region;
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region;

What these delegate methods give you is a easy way to set local notification on a iOS device. So for example you can provide an interface where a user wants to be notified about something when he enters a region. The definition of region is nothing but latitude, longitude with a radius defined. Ex. when you enter a certain region on your way to work you can set a reminder to drop off laundry. etc. It's all actually pretty easy...

To add a little bit more. There are 2 sides to this. First setting the notification, next is consuming or showing the notification. Setting the notification is a straightforward user's current location capture. While doing tell locationManager to monitor this region. When the user enters this region (you could have a date as further filtering criteria) then alert the user.

All this will work even if your app is running in background or closed. iOS will take care of this.

[more code here]

Upvotes: 2

Related Questions