查看 Appbadge 是否在 android phone 上呈现

Find if Appbadge is rendered on android phone

我正在使用 ShortcutBadger (https://github.com/leolin310148/ShortcutBadger) 在支持的设备上显示应用徽章。我正在远程发送通知并触发应用徽章。我如何计算特定设备是否触发了应用程序徽章与不支持的设备。是否有相同的回调?

我可以通过查询 phone 中的广播接收器来实现这一点。它在大多数情况下都适用于所需的设备

private boolean supportAppbadge(Context context){

Intent i = new Intent("android.intent.action.BADGE_COUNT_UPDATE", null);
return context.getPackageManager().queryBroadcastReceivers(i, 0).size() >0;

}