5

In the Reminders app introduced with iOS 5 you have the ability to setup a geofence, so your reminder alerts when you come near an address. Location based reminds can also be configured for a specific day. Apple is very efficient about how they handle location and time based reminders in that they do not start tracking your location until it is the day of the reminder.

Example:

It is Monday and I set a reminder for Wednesday to remind me when I get home to take out the trash.

If you pay attention, you will notice that the location services indicator (purple triangle) next to the battery life indicator will not show up until the stroke of midnight on Wednesday.

I am curious if there is a public API that allows your application to respond to time changes like this or if they are using some private APIs.

I was able to find UIApplicationSignificantTimeChangeNotification and applicationSignificantTimeChange: but it is stated in the documentation that

If your application is currently suspended, this message is queued until your application returns to the foreground, at which point it is delivered.

So it leads me to believe this wouldn't work.

My other thought is to use UILocalNotification and set the notification for the time you are interested in and when that notification is fired, execute the code to enable location services. Due to my lack of experience with UILocationNotification however I do know if it is possible to execute such code.

Does anyone know how to achieve this?

Chris Wagner
  • 20,773
  • 8
  • 74
  • 95
  • You can't do it with LocalNotifications, this notifications only shows a popup with the specified message. – Diogo T Mar 12 '14 at 17:06

1 Answers1

0

You can set a local notif (remote notification) with the informations to activate the geofence the day you want to activate your feature.

This wake up your app in the method "didReceiveLocalNotification" of your appDelegate and there you put your code geofence.

NikLoy
  • 428
  • 6
  • 15