There are lots Huawei icon badges related threads in SO, like How to show App Icon Badge Numbers on Huawei, and I have read the official document of Badges.
I do think the official documents are good enough, I just want to know how may we test it automatically?
For example, if one of the engineers in the team who mis-config the config the Badge-related SDK files, customers' Huawei phone would still able to push the notification, but the Badge number might not show.
I believe the image classification tech would help, like, we could test it automatically in the following way:
It may not the best way to test it in these steps, I was wondering if maybe there is any native API to fetch the badge numbers?
The best way to find this kind of information is to look for open source apps, like settings or launcher apps:
If you want to verify whether notification badges or on or off you can do:
Settings.Secure.getInt(context.contentResolver, "notification_badging")
This is even documented in the Settings
class, but the setting name (Settings.Secure.NOTIFICATION_BADGING
) is part of the hidden (internal) API. But still it works, at least it does for stock Android. For Huawei devices you'll have to test by yourself.
For obtaining the badge count, I don't know if it can be directly obtained. From the second link above, it seems you have to make a notification listener to count incoming notifications.