Yes there are also similar questions available in stack, So far, I didn't found any proper concurrent answer from those questions.
How can i download any data or call web-api, When i receive silent push notifications ?
My Code is as below..
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
{
NSDictionary *dicAPS = [userInfo objectForKey:@"aps"];
if(application.applicationState == UIApplicationStateBackground) {
// This is working..
[self callWebService];
}
else if(application.applicationState == UIApplicationStateInactive)
{
// This is not working..
[self callWebService];
}
else
{
// This is working..
//Show an in-app banner
}
}
Note :
1) From web side, I already added "content-available" as 1.
2) I already added below key in Plist.
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
Hopefully, I'll get new hope from your answer.
Regards.