Add unread count badges to Android & iOS devices.
为APP桌面图标添加角标
AppBadge.setAppBadge(count);
The plugin doesn't support AndroidX !! If your project has migrated to androidX, please migrate this plugin to androidX manually. See more: Migrate to androidX .
- APPLE
- HUAWEI
- SAMSUNG
- XIOAMI
- MEIZU
- VIVO
- OPPO
- First, create a custom ModelImpl
xxxModelImpl
extendsIconBadgeNumModel
and override the functionsetIconBadgeNum()
:
class xxxModelImpl:IconBadgeNumModel {
override fun setIconBadgeNum(context: Context, notification: Notification, count: Int): Notification {
// return something...
}
}
- Then, create a new custom launcher type in enum
launchType
in fileLauncherHelper.kt
, add put the type mapping to fileIconBadgeNumManger.kt
:
enum class LauncherType {
GOOGLE,
HUAWEI,
MEIZU,
XIAOMI,
OPPO,
VIVO,
SAMSUNG,
XXX
}
@Throws(Exception::class)
private fun getIconBadgeNumModelByLauncher(launcherType: LauncherType): IconBadgeNumModel {
when (launcherType) {
······
LauncherType.XXX -> return xxxModelImpl()
else -> throw Exception("not support your phone [ Build.MANUFACTURER is null ] $launcherType")
}
}