关于荣耀手机收到推送角标只增不减问题和部分荣耀手机在设置里给不了角标权限问题
实际上单独为荣耀手机设置下角标就ok,方法大体上和华为的一致 只是将huawei稍微修改一下
华为:
添加权限文章来源:https://www.toymoban.com/news/detail-529216.html
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE " />
boolean mIsSupportedBade = true;
if (mIsSupportedBade) {
setBadgeNum(num);
}
/** set badge number*/
public void setBadgeNum(int num) {
try {
Bundle bunlde = new Bundle();
bunlde.putString("package", "com.test.badge"); // com.test.badge is your package name
bunlde.putString("class", "com.test. badge.MainActivity"); // com.test. badge.MainActivity is your apk main activity
bunlde.putInt("badgenumber", num);
this.getContentResolver().call(Uri.parse("content://com.huawei.android.launcher.settings/badge/"), "change_badge", null, bunlde);
} catch (Exception e) {
mIsSupportedBade = false;
}
}
荣耀:
将"content://com.huawei.android.launcher.settings/badge/“改为"content://com.hihonor.android.launcher.settings/badge/”文章来源地址https://www.toymoban.com/news/detail-529216.html
boolean mIsSupportedBade = true;
if (mIsSupportedBade) {
setBadgeNum(num);
}
/** set badge number*/
public void setBadgeNum(int num) {
try {
Bundle bunlde = new Bundle();
bunlde.putString("package", "com.test.badge"); // com.test.badge is your package name
bunlde.putString("class", "com.test. badge.MainActivity"); // com.test. badge.MainActivity is your apk main activity
bunlde.putInt("badgenumber", num);
this.getContentResolver().call(Uri.parse("content://com.hihonor.android.launcher.settings/badge/"), "change_badge", null, bunlde);
} catch (Exception e) {
mIsSupportedBade = false;
}
}
到了这里,关于荣耀手机添加角标的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!