开发者

How to check whether an application can be uninstalled?

I use the PackageManager to get the list o开发者_如何学Gof installed Android applications. But some stock applications cannot be uninstalled from the device. How do I check for those programmatically?

Intent i = new Intent(Intent.ACTION_MAIN, null);
i.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager pm = this.getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities
                                   (i, PackageManager.PERMISSION_GRANTED);


System applications cannot be uninstalled, so check if an application is a system app using the Package Manager and then proceed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜