Push notification 手机操作系统中显示的Bluemix推送通知,单击时,赢得';不要启动应用程序
我正在开发一个使用Bluemix推送通知的应用程序。当应用程序位于前台或后台时,将调用带有完成处理程序的DidReceiveEmotentification(),一切正常 但当应用程序未启动,且通知由其他设备发送时。从顶部向下滑动时,手机会在系统通知中显示推送通知,但单击通知不会启动应用程序。它只是撤销了通知。Android和IOS也是如此 如何通过单击通知启动应用程序 谢谢并致以最良好的祝愿Push notification 手机操作系统中显示的Bluemix推送通知,单击时,赢得';不要启动应用程序,push-notification,ibm-cloud,ibm-mobile-services,Push Notification,Ibm Cloud,Ibm Mobile Services,我正在开发一个使用Bluemix推送通知的应用程序。当应用程序位于前台或后台时,将调用带有完成处理程序的DidReceiveEmotentification(),一切正常 但当应用程序未启动,且通知由其他设备发送时。从顶部向下滑动时,手机会在系统通知中显示推送通知,但单击通知不会启动应用程序。它只是撤销了通知。Android和IOS也是如此 如何通过单击通知启动应用程序 谢谢并致以最良好的祝愿 Jen对于Android,您必须确保在您的AndroidManifest.xml中包含以下内容,这些内
Jen对于Android,您必须确保在您的
AndroidManifest.xml
中包含以下内容,这些内容位于您希望在单击通知后启动应用程序时启动的所需活动中:
<!--Notification Intent -->
<intent-filter>
<action android:name="<Your_Android_Package_Name.IBMPushNotification"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
示例了解更多详细信息。对于iOS,您需要确保您也成功地将应用程序注册到APNs服务。完成此操作后,您将能够通过单击收到的推送通知来打开应用程序
目标c:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:categories]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
return YES;
}
斯威夫特:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let notificationTypes: UIUserNotificationType = UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound
let notificationSettings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: categories)
application.registerUserNotificationSettings(notificationSettings)
application.registerForRemoteNotifications()
}
您可以在此处查看有关推送注册的更多信息:
我还建议查看我们的Bluemix推送示例:
谢谢戴夫,这就解决了问题。谢谢乔希,成功了。swift代码无法编译。抱怨“|”运算符。因此,我使用了以下代码://register app with notification center let settings=UIUserNotificationSettings(forTypes:[.Alert、.Badge、.Sound],categories:nil)UIApplication.sharedApplication().registerUserNotificationSettings(settings)UIApplication.sharedApplication().registerForRemoteNotifications()