检查是否使用包启用或禁用了应用程序 [英] Check if app is enabled or disabled using package

查看:80
本文介绍了检查是否使用包启用或禁用了应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查用户是否启用或禁用了一个应用程序.

I want to check if one application is enabled or disabled by the user.

我唯一知道的是我可以得到这个int

The only thing i know is that i can get this int

int appstate= this.getPackageManager().getApplicationEnabledSetting("com.example.app");

我如何使用此int来检查该应用程序是已启用还是已禁用?

How can i use this int to check if the app is enabled or disabled?

示例

if(......){//is enabled

}
else{
//disabled
}

推荐答案

ApplicationInfo ai = 
               getActivity().getPackageManager().getApplicationInfo("your_package",0);

boolean appStatus = ai.enabled;

感谢阿米尔

这篇关于检查是否使用包启用或禁用了应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆