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 UILocalNotification because it needs user interaction to tap on notification and than only app will wake up and start location manager.
I have also used
[locationManager startUpdatingLocation];
enabled with background Modes Location updates, this is works but it will take lot of battery.
So with using new iOS 7 feature Silent pushNotification
and didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:
method i need to start location manager in background,
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
NSLog(@"Receive RemoteNotification in fetchCompletionHandler with UserInfo:%@",userInfo);
application.applicationIconBadgeNumber=0;
__block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
[self.locationManager startUpdatingLocation];
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
}
Silent Push notification is working correctly ,
Payload for PushNotification:
{"aps" : {"content-available" : 1},"SilentPushId" : "07"}
But this will not start location manager , Please somebody help me.
EDIT:
If it is not possible please give me some suggestions.