Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShortcutBadger 1.1.13 in xiaomi 4c (OS miui 8) #170

Open
congdanh1608 opened this issue Feb 7, 2017 · 13 comments
Open

ShortcutBadger 1.1.13 in xiaomi 4c (OS miui 8) #170

congdanh1608 opened this issue Feb 7, 2017 · 13 comments

Comments

@congdanh1608
Copy link

after i update the ShortcutBadger to 1.1.13 my xiaomi 4c (OS miui 8) show a blank notification when i call this function
ShortcutBadger.applyCount(context, badgeCount);
device-2017-02-07-121340

Thanks!

@leolin310148
Copy link
Owner

Yes, seems we need to control the notification more.

@BelongsH
Copy link

I have same issues in XIAOMI , can you tell me how to control the notification. TK.

sorry , my english is very bad...

@jkasten2
Copy link

jkasten2 commented Feb 28, 2017

@leolin310148 @congdanh1608 @BelongsH Seeing the same blank notification on a Xiaomi Redmi 4 running Android 6.0.1 and MIUI 8.0.3.0.0(MCECNDG). This is due to commit bcb3afd.

It seems with the new MIUI wants you to display a notification to set the badge count.
http://dev.xiaomi.com/docs/appsmarket/technical_docs/badge/

I did a bit of testing with some different settings to the Notification.Builder and I wasn't able to get the badge value to be set to a custom value without it also showing a notification.

By default, without any code in XiaomiHomeBadger.executeBadge the Xiaomi launcher matches the badge value to the number of currently displayed notifications in the notification shade for your app.

@kirby510
Copy link

kirby510 commented Mar 7, 2017

Hi, I saw this issue in Redmi Note 3G (MIUI 8) as well...

@yung-yu
Copy link

yung-yu commented Mar 7, 2017

I saw this issue in Redmi 1s and OS is MIUI 8

@amitsrivastava10
Copy link

Just remove that blank notification by using below code for mi devices:

NotificationManager notoficatioManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notoficatioManager.cancel(0);

@ygnessin
Copy link

@jkasten2 wrote:

By default, without any code in XiaomiHomeBadger.executeBadge the Xiaomi launcher matches the badge value to the number of currently displayed notifications in the notification shade for your app.

I don't have a Xiaomi device to test my app with, so I'd like some clarification: If my app already receives and handles notifications normally, do I need to take any action? It sounds like the badge will just update automatically. Do I still need to use ShortcutBadger.applyNotification()?

@jkasten2
Copy link

As of 1.1.14 of this library ShortcutBadger.applyNotification() no longer has an effect to prevent this bug.

@ygnessin Correct, the launcher by default without any code for MIUI 8 at lest. It may still check for permissions howvever, I have only test with the same AndrdoidManifest.xml permissions this library adds.

If you do need the badge value to differ from the notification count shown in the notification shade you will need to set the count when you display a notification with the below code.

ShortcutBadger.applyNotification(getApplicationContext(), notification, badgeCount);

See this wiki page on the full details of this new method.
https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support

@jkasten2
Copy link

@amitsrivastava10 I wouldn't recommend the hack you posted. I haven't tested this but it would probably still show the blank notification for a split second. The new ShortcutBadger.applyNotification method would be the way to go.

@Malachiasz
Copy link

Malachiasz commented Jul 10, 2017

As of 1.1.14 of this library ShortcutBadger.applyNotification() no longer has an effect to prevent this bug.

@jkasten2 What do you mean about 1.1.14? Does the bug still appear in 1.1.14?

I read that 1.1.14 "Remove Xiaomi from Badger and add Notification Support for Xiaomi devices."

We use 1.1.13 and have people complaining about this bug (for example with Xiaomi Mi5s, Android 6.0.1)

@jkasten2
Copy link

@Malachiasz Calling ShortcutBadger.applyCount on 1.1.14 and newer will not should a blank notification for Xiaomi devices any more, the issue was fixed. The badge value will be set the number of notifications in the shade automatically now.

If you want some other custom value you must show some kind of notification to the user and call ShortcutBadger.applyNotification().

@Malachiasz
Copy link

@leolin310148 In this case the issue should be closed.

@okpoint
Copy link

okpoint commented Mar 12, 2018

ShortcutBadger 1.1.19 does not work on Redmi-4X, ShortcutBadger.applyNotification() does not work.

My device's information:
device-2018-03-12-110722

My code:
wx20180312-110847 2x

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants