【问题标题】:how to show badge counts on launcher icon in my android app?如何在我的 Android 应用程序中的启动器图标上显示徽章计数?
【发布时间】:2018-03-17 23:08:00
【问题描述】:

我尝试了以下意图方法,但它不起作用,

Intent intent = new Intent("android.intent.action.BADGE_COUNT_UPDATE");
    intent.putExtra("badge_count", 3);
    intent.putExtra("badge_count_package_name", getApplicationContext().getPackageName());
    intent.putExtra("badge_count_class_name", MainActivity.class.getName());
    getApplicationContext().sendBroadcast(intent);

【问题讨论】:

  • 用这个很酷的library
  • BADGE_COUNT_UPDATE 不是三星特有的吗?

标签: android android-layout android-fragments badge application-icon


【解决方案1】:

没有标准的做法。但是您可以参考第三方库,但它只支持少数设备。 您可以查看以下库: https://github.com/leolin310148/ShortcutBadger

【讨论】:

  • 此库在 nexus 设备(由 LG 制造)上不显示獾
猜你喜欢
  • 2013-10-11
  • 1970-01-01
  • 1970-01-01
  • 2022-11-10
  • 1970-01-01
  • 1970-01-01
  • 2012-12-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多