I am creating app that needs to wake up in background at particular time .
I have tried :
UILocalNotification : But i Don\'t want to use UILoca
I have successfully implement this Using Silent Pushnotification & it Call startUpdatingLocation and I am able to get location data in delegate method :
Using This Payload:
{
"aps": {
"content-available": 1
},
"SilentPush": "4"
}
I have enabled location & remote notification for Background mode:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
__block UIBackgroundTaskIdentifier bgTask =0;
UIApplication *app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[self.locationManager startUpdatingLocation];
}];
didUpdateLocations
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
lastLoc=[locations lastObject];
[logFile addLocObject:[NSString stringWithFormat:@"Loc: %@",lastLoc]];
}