Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if app is enabled or disabled using package [duplicate]

Tags:

android

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

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

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

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

Example

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

}
else{
//disabled
}
like image 799
Device Avatar asked Aug 16 '14 18:08

Device


People also ask

How do you know if an app is disabled?

From your Home screen, tap the Application screen icon. Find and tap Settings > Apps. Swipe to the Disabled tab.

How do I enable R8 on my Android?

Enabling R8 in your project To enable R8, open build. gradle module app file and add this piece of code inside the buildTypes . The code inside the release{} block means that this will be applied to the release build version of your application. If you launch the app in the emulator, this code is not executed.

How do you check if app is installed or not in android programmatically?

Call the method isPackageInstalled() : boolean isAppInstalled = isPackageInstalled("com. android. app" , this.

How do you know app is installed or not?

If the user has installed the web app using the new Web APK functionality, it is possible to determine if your web app is installed. If you know the package name of your Web APK then you can use the context. getPackageManager(). getApplicationInfo() API to determine if it is installed.


1 Answers

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

boolean appStatus = ai.enabled;

Thanks to Amir

like image 158
Nadeem Iqbal Avatar answered Oct 04 '22 17:10

Nadeem Iqbal