Badge & not running app question on Android

5 posts, 1 answers
  1. Cedric
    Cedric avatar
    5 posts
    Member since:
    Jul 2014

    Posted 08 Jul Link to this post

    Hi there,

    Currently testing push notifications on android hybrid app, I can send notifications to my app, that are received only when app is running and has focus.
    When it is not, I have notifications in notification area, and nothing more.

     --> Is there a way to have a badge on app showing that notification is awaiting ? I have seen people on forum talking about it, but seems only in IOS, how is it possible on android ?
     --> When a notification has been sent while app is offline, how can i be notified if user clicks app icon (not clicking the notification which calls callback correctly). Question was asked in 2014 here http://www.telerik.com/forums/push-notification-app-not-running, I am wondering if sth changed since... If not, what would you advise me to do not to miss any notification ?

    thanks & regards,


    Cédric

  2. Martin
    Admin
    Martin avatar
    67 posts

    Posted 12 Jul Link to this post

    Hi Cedric,

    1. When the app is in the background, the received push notifications are handled on operating system (OS) level - an OS-specific notification is shown.

    However, when the app is in the foreground you are responsible for handling the push notification event by using  the notificationCallbackIOS, notificationCallbackAndroid, or notificationCallbackWP8callback function on iOS, Android, or Windows Phone respectively as described in the documentation here.

    Therefore when you tested and the app was in the foreground, the functions in the push notification sample hybrid app show the full content of the notification object received, whereas when the app was is in the foreground, the notification is received but handled by the OS and only a specific notification message is shown in the notification tray/notification center.

    2. Clicking the app icon does not show the push notification - the push notification even described above is not always available as described in the documentation. For instance, when you have received a notification (it is in the notification tray in Android or in the notification center in iOS) and you click on the app icon, the event is not available and therefore the notificationCallbackIOSnotificationCallbackAndroid, or notificationCallbackWP8callback are not executed.

    This behaviour is by design of the native platform (Android / iOS) and cannot be altered.

    3. An icon badge count is an iOS specific feature that is not available by design on Android.

    I hope this has helped.


    Regards,
    Martin
    Telerik by Progress
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  3. Cedric
    Cedric avatar
    5 posts
    Member since:
    Jul 2014

    Posted 13 Jul Link to this post

    Thanks for your clear reply

    This means that android hybrid apps are unable to show badges on new notifications.That is somehow disturbing to me, I think that badges are meaningless if not coupled to notifications. Many apps have this fonctionnality, none of them are hybrid apps ?

     

  4. Cedric
    Cedric avatar
    5 posts
    Member since:
    Jul 2014

    Posted 13 Jul Link to this post

    i have keept searching on the subject and found out that android badges are now supported on phonegap original plugin

    https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushsetapplicationiconbadgenumbersuccesshandler-errorhandler-count---ios--android-only

    is it possible to merge these into telerik plugin ?

  5. Answer
    Martin
    Admin
    Martin avatar
    67 posts

    Posted 15 Jul Link to this post

    Hi Cedric,

    Thank you for your feedback.

    Here is some more information about badge icon in Android:

    1. Android ("vanilla" android without custom launchers and touch interfaces) does not allow changing of the application icon, because it is sealed in the .apk tightly once the program is compiled. There is no way to change it to a 'drawable' programmatically using standard APIs. This applies not only for hybrid apps but for native Android apps as well.

      Icon badge is perceived as an iOS-specific way of notifying the user and also it appears that for a specific functionality involving its usage there is a patent. On Android new alerts are usually placed in in the system-wide notification tray - please review Google's guidelines about push notifications design.
    2. Some apps do have a badge on the icon - setting an icon badge is possible as Android is open source and highly customizable. Still there s no standard way to do it for all Android devices:
      • Some manufacturers like Sony, Samsung and HTC have modified the "vanilla" Android in order to include a badge in the icon or use a custom launcher to alter the native Android look.
      • Using a custom launcher (like Nova launcher) can also allow setting a badge in the icon. Still the use of customer launcher is in the hands of the user, not on the developer.

    3. You may try to add an icon badge in Android in your hybrid app by using Cordova Badge Plugin. The plugin relies on a library called ShortcutBadger, which is supported for some custom launchers ("vanilla" Android is not supported - therefore the user experience will not be the same on different Android devices). The phonegap-plugin-push you mentioned also relies on ShortcutBadger as stated in their documentation.

    If you find this feature meaningful you may send a feature request / issue in the GitHub repository of the Telerik push plugin.

    I hope this was helpful.


    Regards,
    Martin
    Telerik by Progress
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top