使用bluemix for ios的静默远程通知
有没有办法通过bluemix发送静默或混合远程通知?仪表板中没有此类选项 我希望我的应用程序在收到远程通知时在后台提取数据 编辑(从注释复制粘贴): 我的意思是什么是从Bluemix端发送混合推送通知的方式,而不是如何在客户端处理它。解决方案是使用REST API:使用bluemix for ios的静默远程通知,ios,push-notification,ibm-cloud,ibm-mobile-services,Ios,Push Notification,Ibm Cloud,Ibm Mobile Services,有没有办法通过bluemix发送静默或混合远程通知?仪表板中没有此类选项 我希望我的应用程序在收到远程通知时在后台提取数据 编辑(从注释复制粘贴): 我的意思是什么是从Bluemix端发送混合推送通知的方式,而不是如何在客户端处理它。解决方案是使用REST API: POST https://mobile.eu-gb.bluemix.net/imfpush/v1/apps/$(app_id)/messages 附正文: "settings": { "apns": { "type":'MIXE
POST https://mobile.eu-gb.bluemix.net/imfpush/v1/apps/$(app_id)/messages
附正文:
"settings": { "apns": { "type":'MIXED' }
通知的处理是在客户端完成的,您想要做的当然是可能的。从Bluemix文档中获取推送通知链接 无声通知不会出现在设备屏幕上。这些通知由应用程序在后台接收,这将唤醒应用程序长达30秒,以执行指定的后台任务。用户可能不知道通知到达。 要处理静默推送通知,请在appDelegate.m中实现以下方法 服务器为静默通知发送的contentAvailable值等于1
我也在努力寻找解决方案,似乎就是这样的类型:'Mixed'在json模型中不再(不再?)有效(在bluemix push api参考中没有提及)。嗨,James,问题是如何使用rest api发送静默通知,而不是如何在客户端处理它。由于某些原因,当文档提到如何在客户端处理时,似乎不可能(再?)使用RESTAPI触发静默通知!在API(worklight server)的其他“风格”中定义通知类型似乎是可能的,但在bluemix上却不可能。。。
// For Objective C
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
NSNumber *contentAvailable = userInfo[@"aps"][@"content-available"];
if([contentAvailable intValue]== 1){
[[IMFPushClient sharedInstance] application:application didReceiveRemoteNotification:userInfo];
//Perform background task
NSLog(@"Received a silent push..");
NSLog(@"userInfo: %@", userInfo.description);
_appDelegateVC.result.text = userInfo.description;
handler(UIBackgroundFetchResultNewData);
}
else{
//Normal Notification
[[IMFPushAppManager get] notificationReceived:userInfo];
NSLog(@"Received a normal notification.");
NSLog(@"userInfo: %@", userInfo.description);
_appDelegateVC.result.text = userInfo.description;
handler(UIBackgroundFetchResultNoData);
}
//Success
}