清除数据并在android中卸载应用程序后如何清除计数标志? [英] How to clear count badge after clearing data and uninstall application in android?
问题描述
问题是当我安装应用程序并使用它时,它在应用程序图标上显示计数标志。现在,当我卸载应用程序(当计数徽章显示在应用程序图标上)并重新安装该应用程序时,它再次在应用程序图标上显示徽章计数。
The problem is when I install application and use it, it shows count badge on application icon. Now when I un-install application (while count badge is being displayed on application icon), and re-install the application, it again shows badge count on application icon.
(注意:-这是在卸载应用程序时显示的最新徽章计数)
我的问题是:
-
为什么重新安装应用程序后会显示徽章计数?
Why badge count is being displayed after re-installing application?
不执行-安装应用程序无法清除其全部数据吗?
Do un-installing an application not clear its whole data?
在卸载应用程序时可以清除徽章计数吗?
Can I clear the badge count when I un-install the application?
如果不可能,那么有人可以为我提供任何链接吗?
If its not possible, then can anybody provide me any link for the same?
我将徽章计数与以下链接的帮助:-
I integrated badge count with the help of the following link:-
How to interface with the BadgeProvider on Samsung phones to add a count to the app icon?
推荐答案
您链接的问题/答案实际上具有如何清除徽章的答案。
The question/answer you link actually has the answer on how to clear badges.
ContentValues cv = new ContentValues();
cv.put("badgecount", 0);
getContentResolver().update(Uri.parse("content://com.sec.badge/apps"), cv, "package=?", new String[] {getPackageName()});
https ://stackoverflow.com/a/20136484/940834
因此,只需调用此方法即可清除徽章。
So just call this method appropriately to clear the badge.
例如,检查是否是从全新安装以来第一次加载应用,然后应用。
For example, check if first time loading app since fresh install, then apply.
// CHECK IF FIRST LOAD
if(!PreferenceManager.getDefaultSharedPreferences(this).contains("NOTFIRSTLOAD"))
{
ContentValues cv = new ContentValues();
cv.put("badgecount", 0);
getContentResolver().update(Uri.parse("content://com.sec.badge/apps"), cv, "package=?", new String[] {getPackageName()});
// Store that its not first load
PreferenceManager.getDefaultSharedPreferences(this).edit().putInt("NOTFIRSTLOAD", 1).commit();
}
阅读原始问题/答案以获取更多信息
Read origional question/answer for more info
这篇关于清除数据并在android中卸载应用程序后如何清除计数标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!