0
votes

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??

1
The only way I can think to do this with Parse is to have the client reports it's location to Parse. Then you would need some cloud code to do the rest. There is nothing that I know of built into Parse specifically for this scenario. - Rip Ryness

1 Answers

0
votes

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"