I have tried below intent method but it does not work,
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);
There is no standard way of doing. But you can refer to third party libraries but it supports only few devices. You can check the below library : https://github.com/leolin310148/ShortcutBadger