问题
On testing Worklight push notification for Android, if the alert (notification message) is empty, the app icon with app name will be displayed in notifications bar without any notification message.
May I know how Worklight will handle this case if alert is empty in iOS? Will the notification alert be prompted? The reason to ask so is that I would like to update the badge number only without launching an alert box if there is update from server even though the app is closed.May I know whether badge in Push Notification is applicable on iOS only but not Android? As the document here said that:
"GCM alert Optional. A string to be displayed in the alert. badge Mandatory. An integer value to be displayed in a badge on the application icon." But on my testing, there is no badge appeared for Android app.Notice that there is an API to set the number of badge (WL.Badge.setNumber) or I can set it in Push Notification API (WL.Server.Notifyxxx - notificationOptions).
Can I get the number of badge currently to do increment instead of just setting a number to it?
Environment: Worklight 5.0.6, Samsung Galaxy S3 Android 4.1.1
Thanks!
回答1:
- Without sending text with your notification, iOS will not display an alert (banner or modal dialog, depending on what the user chooses for the app in the Notifications section in Settings.app). It will only make a sound, if you choose so.
- Badge support is for iOS only. I'll have the "badge" mention removed from that Information Center article. Thanks.
- There is currently no API to get the current number of badges. In the meanwhile, perhaps you can use a Cordova plug-in to get the current value of the app icon badge.
来源:https://stackoverflow.com/questions/15831893/ibm-worklight-push-notification-and-badge