B4A Library ShortcutBadger V1.5

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Mar 5, 2016.

  1. DonManfred

    DonManfred Expert Licensed User

    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:
    Code:
    AddPermission(com.sec.android.provider.badge.permission.READ)
    AddPermission(com.sec.android.provider.badge.permission.WRITE)
    For HTC:
    Code:
    AddPermission(com.htc.launcher.permission.READ_SETTINGS)
    AddPermission(com.htc.launcher.permission.UPDATE_SHORTCUT)


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


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

    Code:
    AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)
    Code used

    Code:
    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
    [​IMG]

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

    Attached Files:

    Last edited: Dec 13, 2017
  2. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    As usual a great library from a great wrapper :)

    If we want it to work on all launchers that support count , we should add all these lines to manifest .
    Am I right ?
     
  3. DonManfred

    DonManfred Expert Licensed User

    I dont know exactly. But that´s what i would try to do too.
     
    somed3v3loper likes this.
  4. Johan Schoeman

    Johan Schoeman Expert Licensed User

    DonManfred likes this.
  5. itgirl

    itgirl Active Member Licensed User

    Amazing one thank you so much ;) another entry for my bookmarks
     
    DonManfred likes this.
  6. Daniel-White

    Daniel-White Active Member Licensed User

    Nice job, and very friendly to use, DonManfred, I did a test in Lg-G2 with android ver 4.4.2 work smoothly, however in my Samsung Pocket Neo with Android ver 5.0.2 does not show the count n#17. My understanding, I don't know it is 100% true, I had been reading about it in Internet, some phone brands do not allow that feature.

    I had been asking one month ago about how we can do this feature. thanks for share it. :D
     
  7. MarcoRome

    MarcoRome Expert Licensed User

    10+ ;) Great Work Don
     
    DonManfred likes this.
  8. DonManfred

    DonManfred Expert Licensed User

    That´s true.
    You can use an Alternative Launcher like NOVA on these Devices as workaround
     
    Daniel-White likes this.
  9. MarcoRome

    MarcoRome Expert Licensed User

    Hi Don you have another my DONATION ( 9M2996021X0782237 ) for your work is great.
    Thank you again for your work.
    Regards
    Marco
     
    DonManfred likes this.
  10. DonManfred

    DonManfred Expert Licensed User

    Thank you very much! :)
    :)
    I´m sure there will follow more :D
     
    MarcoRome likes this.
  11. Peter Simpson

    Peter Simpson Expert Licensed User

    Ooh a very nice library @DonManfred, and it works perfect as usual...
     
  12. Bel

    Bel Active Member Licensed User

    Perfect library.
    It dont working in Huawe phone,what i am doing?
     
  13. MarcoRome

    MarcoRome Expert Licensed User

    Try this:
    Code:
    AddPermission(com.huawei.launcher3.permission.READ_SETTINGS)
    AddPermission(com.huawei.launcher3.permission.WRITE_SETTINGS)
    AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
    AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
    AddPermission(com.huawei.android.launcher.permission.WRITE_SETTINGS)
    AddPermission(com.huawei.android.launcher.permission.READ_SETTINGS)
     
  14. Bel

    Bel Active Member Licensed User

    Thanks i try it
     
  15. DonManfred

    DonManfred Expert Licensed User

    Huwei is not on the list of supported Launchers (See Github-Link in Post #1)
    If the suggestion of @MarcoRome is not working then this library does not work on Huwei. I´m sorry.
     
  16. BarryW

    BarryW Active Member Licensed User

    What is permission for MIUI RedMi
     
  17. DonManfred

    DonManfred Expert Licensed User

    All possible Models supported by the lib are listed in Post #1
     
  18. BarryW

    BarryW Active Member Licensed User

    The version 1.1.2 say that theres a support for com.miui.mihome2
     
  19. DonManfred

    DonManfred Expert Licensed User

    I´ve updated the lib to V1.1 which reflects the newest Github release. See Download in Post #1

    But i cant help on setting it up on your device. I did not found info about it... Maybe you need to ask the githubproject-author how to do for miui...
     
  20. biometrics

    biometrics Active Member Licensed User

    I needed the following manifest entry for it to work on my Sony Z3:

    Code:
    AddPermission(com.sonymobile.home.permission.PROVIDER_INSERT_BADGE)
    This is my current manifest entries, if you have more please share them here:

    Code:
    'Samsung
    AddPermission(com.sec.android.provider.badge.permission.READ)
    AddPermission(com.sec.android.provider.badge.permission.WRITE)
    'HTC
    AddPermission(com.htc.launcher.permission.READ_SETTINGS)
    AddPermission(com.htc.launcher.permission.UPDATE_SHORTCUT)
    'Sony
    AddPermission(com.sonyericsson.home.permission.BROADCAST_BADGE)
    AddPermission(com.sonymobile.home.permission.PROVIDER_INSERT_BADGE)
    'Apex
    AddPermission(com.anddoes.launcher.permission.UPDATE_COUNT)
    'Solid
    AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)
    'Huawei
    AddPermission(com.huawei.launcher3.permission.READ_SETTINGS)
    AddPermission(com.huawei.launcher3.permission.WRITE_SETTINGS)
    AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
    AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
    AddPermission(com.huawei.android.launcher.permission.CHANGE_BADGE)
    AddPermission(com.huawei.android.launcher.permission.WRITE_SETTINGS)
    AddPermission(com.huawei.android.launcher.permission.READ_SETTINGS)
    'Zuk
    AddPermission(android.permission.READ_APP_BADGE)
    'Oppo
    AddPermission(com.oppo.launcher.permission.READ_SETTINGS)
    AddPermission(com.oppo.launcher.permission.WRITE_SETTINGS)
    'EvMe
    AddPermission(me.everything.badger.permission.BADGE_COUNT_READ)
    AddPermission(me.everything.badger.permission.BADGE_COUNT_WRITE)
    Thanks DonManfred.
     
    Last edited: Aug 6, 2017
    Toky Olivier likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice