app_badge 0.0.2

Flutter Android iOS

A Flutter plugin for setting application icon badge. Support all Apple devices and part of Android devices.

app_badge #

Add unread count badges to Android & iOS devices.
为APP桌面图标添加角标

Usage: #

AppBadge.setAppBadge(count);

Support Devices #

  • [x] APPLE
  • [x] HUAWEI
  • [x] SAMSUNG
  • [x] XIOAMI
  • [x] GOOGLE
  • [ ] MEIZU
  • [ ] VIVO
  • [ ] OPPO

Add Custom Devices #

  • First, create a custom ModelImpl xxxModelImpl extends IconBadgeNumModel and override the function setIconBadgeNum():
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 file LauncherHelper.kt, add put the type mapping to file IconBadgeNumManger.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")
        }
    }

Welcome to PR if you can fit other Android devices !!!

5
likes
90
pub points
52%
popularity

A Flutter plugin for setting application icon badge. Support all Apple devices and part of Android devices.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

yumi930629@gmail.com

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on app_badge