Android Question ShortcutBadger 1.5 & Android 8+ Samsung

Tommaso

Member
Licensed User
Hi DonManfred,
I've tried ShortcutBadger on Android 8-9 (Device Samsung S8 and Samsung Note9) without success
badge icon not be shown

Is there something to do with newer device/android version?
We've seen this thread:
https://github.com/leolin310148/ShortcutBadger/issues/266
seems there is a new call on android sdk 26+ like:
NotificationCompat.Builder.setNumber(int)
Could be called with reflector calling this when SDK >= 26 still calling your library so I ensure badge works on (almost) all environment?

Thanks in advance
Regards Tommaso
 

DonManfred

Expert
Licensed User

MMORETTI964

Member
Licensed User
Hi @DonManfred seems the "badger system" was overriden by this notification system (as part of Android 8 notification, maybe not for all OEM).

Have you tried to manage the app-icon-badge-number through this notification? We havent' found an example for it.

Using ShortcutBadger on the devices Samsung on SDK26+ seems don't work.

Many thanks in advance for your helps.
Maurizio
 
Last edited:

DonManfred

Expert
Licensed User
I know. I also noted that it does not work anymore.

But based on the findings it only works when the app is showing a notification and one should set the badgecount to this notification. I guess the NB Class can set the counter...

There isn´t much i can do; you need to handle them by yourself

From NB Class...
B4X:
'One of the following values: NONE, SMALL, LARGE
'Not supported by all launchers.
Public Sub BadgeIconType (IconType As String) As NB6
    If SdkLevel >= 26 Then
        Dim m As Map = CreateMap("LARGE": 2, "NONE": 0, "SMALL": 1)
        NotificationBuilder.RunMethod("setBadgeIconType", Array(m.Get(IconType)))
    End If
    Return Me
End Sub

'Sets a number that might be displayed as a badge.
Public Sub Number (Num As Int) As NB6
    If IsOld Then
        OldNotification.Number = Num
    Else
        NotificationBuilder.RunMethod("setNumber", Array(Num))
    End If
    Return Me
End Sub
 

MMORETTI964

Member
Licensed User
FYK ... Some result of SetNumber (NB6) and ShortcutBadger, only the Nexus5 remains out of works...

Notification (SetNumber)

WORK - Samsung Note9 - ANDROID 9
WORK - Samsung S8 - ANDROID 8
NOT WORK - Samsung Galaxy ANDROID 4.4
NOT WORK - Samsung Galaxy ANDROID 7.0
NOT WORK - Nexus5 ANDROID 8.1



ShortcutBadger

WORK - Samsung Galaxy ANDROID 4.4
WORK - Samsung Galaxy ANDROID 7.0
NOT WORK - Nexus5 ANDROID 8.1
NOT WORK - Samsung NOTE9 - ANDROID 9
NOT WORK - Samsung S8 - ANDROID 8

Many thanks to your support.

Maurizio
 
Top