App Badge with Push Notifications

4 posts, 1 answers
  1. Dan
    Dan avatar
    26 posts
    Member since:
    Oct 2013

    Posted 12 Aug 2014 Link to this post

    I have got Telerik Back End Services set up to send messages to my app on iOs and Android.  I can successfully send a message to the device.

    When the app is not running, how can I set a badge on the App's Icon that a push notification has been delivered.

    Can this be done without writing a server application to format the notification Json message?
  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 13 Aug 2014 Link to this post

    Hello Dan,

    Thank you for contacting Telerik support.

    The badge on the app's icon will be automatically set to the value contained in the badge key of the notification payload for iOS. This happens only if the app is in the background when the notification is received. Unfortunately, the notifications sent from the portal does not contain this key in the payload. You will need to send a notification with the following payload (using a tool like Fiddler or Postman):
    {
       "IOS": {
            "aps": {
                "alert": "Push message for iOS",
                "badge": 1,
                "sound": "default"
            }
    }

    More on the supported structure for the notification payload can be read here.

    In Android you can set the msgcnt key in order to add a count for the notification entry in the notification tray. 

    Please, let us know if you have questions.

    Best regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  3. Dan
    Dan avatar
    26 posts
    Member since:
    Oct 2013

    Posted 13 Aug 2014 in reply to Anton Dobrev Link to this post

    I am using Telerik Back End Services to send the messages.  I only see a message field.  Is it possible to send more than just a message in the message field or do I have to not use Telerik BaaS to send the notifications to get the badges?
  4. Answer
    Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 14 Aug 2014 Link to this post

    Hello Dan,

    As to your questions.

    In short, the value in the "Message" field will be used only to populate the 'alert' field (e.g. the message text) in the payload for iOS, you cannot enter other values.

    In details - the Backend Services portal allows you to send a platform-specific and broadcast messages. The current logic that prepares the notification payload has introduced some discrepancies in the result for iOS between the two operations:

    - When sending a Broadcast message the payload for iOS will contain the 'badge' field which will place a badge with a number on top of the app's icon. However, a 'sound' key is not included in the payload and the default sound will not be played.
    - When sending a Platform Specific message for iOS the payload contains the 'default' sound, but does not contain the 'bagde' and thus a badge is not shown.

    The issue is already logged into our backlog.

    In the Backend Services API the supported structure for the notification payload is much larger than the functionality offered in the portal. As a temporary workaround to the issue described above and if you would like to send a more tailored and specific payload for each notification you can take a look into the structure and use an external tool, for instance, a tool like Postman or Fiddler. You just need to send the payload as a JSON object in the body of the POST request to the respective endpoint in the Backend Services API.

    Please, let us know if further questions arise.

    Regards,

    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top