Reputation: 189
I am trying to create local notifications for my iOS application based on JSON new data.
I have created web services and parsing some datas and store into plist as a string at first time. I want to parse JSON at every n minutes once and compare with plist stored data for anything newly arrived datas or not. If anything newly arrived I want to show notification.
Those process want to do application active and background both times without any hanging.
Thanks,
Upvotes: 0
Views: 589
Reputation: 3690
You can use Silent Push Notifications,if Push notification serve your purpose.It doesn't come in notification tray.
1.As soon as when notification comes , Below method is called,overide this method
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
completionHandler(UIBackgroundFetchResult.NewData)
NSLog("Download From Remote Notification%@",userInfo)
}
2.Enable Remote notification
No user Interaction is needed in silent push notification
Here is good article which explains step by step guide
http://www.g8production.com/post/72656082173/ios7-multitasking-silent-notifications
Upvotes: 0
Reputation: 8855
If you want to update data from the server in the background, you basically have 2 options:
Which one you should use depends on things like
Upvotes: 1
Reputation: 69489
iOS does not support these kind of background service. The reason being that they drain the battery and therefor give the user a bad experience. You might want to implement it serverside.
Apple only allows background running for apps that fall the in following categories: VOIP, audio streaming, location and accessory (bluetooth).
Upvotes: 2