ShortcutBadger library implementation

I want to implement ShortcutBadge, to show counter for push notification on my app icon. gotten from: https://github.com/leolin310148/ShortcutBadger

i have added the library successfully. my app has GcmMessageListenerService.java class.

and below methods.

onMessageReceived()

showNotification()

i am suppose to use like this:

    int badgeCount = 1;
    ShortcutBadger.applyCount(context, badgeCount);

but cant get it to work when i paste above code on any of my methods on GcmMessageListenerService.java. Thanks for your help.

1 answer