Im familiar with Parse Push notifications, but while planning an app i had an idea to send a push notification once a user is in a certain location (a park, a museum, etc)
Is this possible??
Im familiar with Parse Push notifications, but while planning an app i had an idea to send a push notification once a user is in a certain location (a park, a museum, etc)
Is this possible??
This can be done easy and with out parse. Add this code in your app delegate
// START WITH
[self.locationManager startUpdatingLocation];
pragma mark - CLLocationManagerDelegate
/*
* locationManager:didUpdateToLocation:fromLocation:
*
*/
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
if (UIApplication.sharedApplication.applicationState == UIApplicationStateActive)
{
// ACTIVE APP, pin in a map
}
else
{
NSLog(@"App is backgrounded. New location is %@", newLocation);
// LOCAL PUSH IF NEAR.
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"You are near";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
}
Remember to add in your info.plist
"App registers for location update"