0
  1. 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.

  2. 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.

  3. 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!

red23jordan
  • 2,841
  • 10
  • 41
  • 57

1 Answers1

1
  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.
  2. Badge support is for iOS only. I'll have the "badge" mention removed from that Information Center article. Thanks.
  3. 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.
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • Thanks Idan. For #1, can notification bar not being shown if there is no text with the notification in Android? Or it is a Worklight feature? – red23jordan Apr 07 '13 at 15:54
  • That's an Android feature, not Worklight. – Idan Adar Apr 07 '13 at 15:59
  • For my understanding if there is notification received from GCM, we need to create a GCMIntentService class and onMessage() method will be overriden to determine how to handle the notification received. [(Reference in Android GCM - Step 3)](http://developer.android.com/google/gcm/gs.html) Normally, NotificationManager is used to displayed the message on notification bar. So, I think it is a Worklight feature to determine how the received notification is handled ... ? – red23jordan Apr 07 '13 at 16:46
  • You're correct. I've done some inquiries and indeed this is different in Android than iOS (where you (or us...) are not given any control. In Android, we've wrapped around the GCMIntentService, however we do not provide what you're thinking of. You can, however, extend GCMIntentService to add what you want, but do keep in mind that you could possibly break other Worklight stuff in there, and we cannot provide support in such cases. – Idan Adar Apr 08 '13 at 05:07
  • Thanks for your reply. For #3, yes, there is cordova plugin to get the current number of badges. However, for the push notification case, when the badge number (e.g. 1) is sent with the notification message to client and the app is closed at this moment. It seems to me that I cannot update the badge number instead of using the one directly from server. Is it correct? – red23jordan Apr 10 '13 at 11:19
  • Looks like it. I don't have a solution. – Idan Adar Apr 10 '13 at 11:49