简体   繁体   English

IBM Worklight 5.0.5:控制Worklight推送通知通过OS的通知句柄进行订阅/取消订阅

[英]IBM Worklight 5.0.5:Control Worklight Push notification Subscribe/Unsubscribe through OS's notification handle

I want to invoke the WL.Client.Push.subscribe(alias, options) or WL.Client.Push.unsubscribe (alias, options) through the Show notifications in Android and Include in iOS. 我想通过Android中的Show notifications和iOS中的Include调用WL.Client.Push.subscribe(alias, options)WL.Client.Push.unsubscribe (alias, options) Instead of adding a Subscribe/Unsubscribe handle in my app,i want it to be handled through the OS's controls. 我希望不通过我的应用程序添加“订阅/取消订阅”句柄,而是希望通过操作系统的控件来处理它。

Android通知控件

iOS通知控件

Those things are not the same. 那些东西不一样。

Subscribing/unsubscribing to push notifications is one thing. 订阅/取消订阅推送通知是一回事。 Controlling how the notifications are displayed/displayed at all in the device is another. 控制通知如何在设备中完全显示/显示是另一回事。

The answer is then, IMO: No, you can't use those features to control whether your application (device, rather) is subscribed or unsubscribed from push notifications. 答案是IMO:不,您不能使用这些功能来控制您的应用程序(设备)是订阅还是取消订阅推送通知。

By subscribing/unsubscribing, you manage the server state regarding the notifications. 通过订阅/取消订阅,您可以管理有关通知的服务器状态。

That said, in your application you should be able to query for the state of these controls for the app (in iOS that should be UIApplication > enabledRemoteNotificationTypes), and based on the result to subscribe or unsubscribe. 就是说,在您的应用程序中,您应该能够根据应用程序的这些控件的状态(在iOS中应为UIApplication> enabledRemoteNotificationTypes)查询订阅或取消订阅的结果。 To do that, you'll need to write a Cordova plug-in. 为此,您需要编写一个Cordova插件。 I don't know how well that was supported back in Worklight 5.0.5.x, that is a pretty old version of Worklight. 我不知道Worklight 5.0.5.x所支持的程度如何,那是Worklight的相当老的版本。

You should tell your customer to upgrade. 您应该告诉您的客户升级。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM