B4A Library ShortcutBadger V1.7

This is a wrap for this Github project

The ShortcutBadger makes your Android App show the count of unread messages (or whatever count you want to show) as a badge on your App shortcut on your "Desktop"

ShortCutBadger
Author:
DonManfred (wrapper)
Version: 1.5
  • ShortcutBadger
    Methods:
    • Initialize
    • IsInitialized As Boolean
    • applyCount (badgeCount As Int) As Boolean
      Tries to update the notification count
      context: Caller context
      badgeCount: Desired badge count
      Return type: @return:true in case of success, false otherwise
    • applyCountOrThrow (badgeCount As Int)
      Tries to update the notification count, throw a {@link ShortcutBadgeException} if it fails
      context: Caller context
      badgeCount: Desired badge count
    • removeCount As Boolean
      Tries to remove the notification count
      context: Caller context
      Return type: @return:true in case of success, false otherwise
    • removeCountOrThrow
      Tries to remove the notification count, throw a {@link ShortcutBadgeException} if it fails
      context: Caller context

Please note that the Example here is prepared to be used on Samsung Devices as it contains the Permissions needed on Samsung Device.

Note the AppPermission commands in manifest editor:

For Samsung:
B4X:
AddPermission(com.sec.android.provider.badge.permission.READ)
AddPermission(com.sec.android.provider.badge.permission.WRITE)

For HTC:
B4X:
AddPermission(com.htc.launcher.permission.READ_SETTINGS)
AddPermission(com.htc.launcher.permission.UPDATE_SHORTCUT)

For SONY:
B4X:
AddPermission(com.sonyericsson.home.permission.BROADCAST_BADGE)

For APEX:
B4X:
AddPermission(com.anddoes.launcher.permission.UPDATE_COUNT)

For Solid:

B4X:
AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)

Code used

B4X:
Sub Globals
  'These global variables will be redeclared each time the activity is created.
  'These variables can only be accessed from this module.
  Dim badge As ShortcutBadger
End Sub

Sub Activity_Create(FirstTime As Boolean)
  'Do not forget to load the layout file created with the visual designer. For example:
  'Activity.LoadLayout("Layout1")
  badge.Initialize()

  badge.applyCount(17)
End Sub

Please Note the count of 17 to find the icon in the Screenshot

The Screenshot here is from the Nova Launcher running on my Samsung S6 EDGE
Screenshot_20160303-201736.png


If you want to donate for my work building the wrapper you can do it here:
 

Attachments

  • libShortcutBadgerV1.0.0.zip
    15.4 KB · Views: 648
  • ShortCutBadgerV1.1.zip
    23.1 KB · Views: 561
  • ShortcutBadgerV1.5.zip
    27.2 KB · Views: 621
  • ShortcutBadgerEx.zip
    9.7 KB · Views: 508
  • ShortcutBadgerV1.7.zip
    30.1 KB · Views: 569
Last edited:

Graeme Tacon

Member
Licensed User
Longtime User
This isn't working for me on my SGS8 with Android 7. Even the example doesn't work. Anyone else having the same trouble ?
 

kisoft

Well-Known Member
Licensed User
Longtime User
HI
I would like to test but it does not work on LG G6, LG G3, Samsung Galaxy A5.
I put in the manifest all the permissions from entry #20.
 

DonManfred

Expert
Licensed User
Longtime User
but it does not work on LG G6, LG G3
LG is not on the list of supported Manufacturers. Seems LG does not support it.
Samsung Galaxy A5.
I do not have such device. Maybe Samsung has made an limited Android/Launcher App in these device.
 

kisoft

Well-Known Member
Licensed User
Longtime User
HI
LG is on the list of supported devices. (by clicking the link from the first post). I would have to add permissions to the manifest. Only what?
 

DonManfred

Expert
Licensed User
Longtime User
LG is on the list of supported devices.
yes, i know. On the Github page and in the source there is a hint that LG class is deprecated. LG devices will use the Base Class.
Away from that i can not answer. I did not see any LG specific permission or so.
 

Declan

Well-Known Member
Licensed User
Longtime User
I am using V1.5.
Working great on Huawei and Samsung Note 10.
Just one problem - I can never get rid of the "1" in the "le dot"
I have tried setting "badge.removeCount" / "badge.applyCount(0)".
It is a persistent little guy #1 - always there.
 
Top