android-applicationinfo

How can I find if a particular package exists on my Android device?

寵の児 提交于 2019-11-26 14:22:07
How can I find whether a particular package or application, say: com.android.abc , exists on my Android device? Rasel Call any of the below method with the package name. import android.content.pm.PackageManager; // ... public boolean isPackageExisted(String targetPackage){ List<ApplicationInfo> packages; PackageManager pm; pm = getPackageManager(); packages = pm.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if(packageInfo.packageName.equals(targetPackage)) return true; } return false; } import android.content.pm.PackageManager; public boolean isPackageExisted

How can I configure Launcher activity programmatically in android?

安稳与你 提交于 2019-11-26 12:46:51
问题 I am working on an app with two activities : LoginActivity and MainActivity . When the user first opens the app he will login and his credentials (username and token) are saved in Preferences . Now, if the user opens the app again then MainActivity should start. I tried to switch between these activities in Application class and removed intent-filter for LAUNCHER_ACTIVITY from manifest, but it doesn\'t work. Is there any way of switching between Launcher Activities programmatically on basis

How do I check if an app is a non-system app in Android?

大兔子大兔子 提交于 2019-11-26 12:37:35
问题 I am getting a list of ApplicationInfo Objects with packageManager.getInstalledApplications(0) and attempting to categorize them by whether or not they are a system application. For a while I have been using the technique described here, however after seeing that in my application, some of the apps were not in the non-system apps list (such as Facebook , which when available asks the system to install itself on the SD card). After next reading the actual documentation for ApplicationInfo.FLAG

How can I find if a particular package exists on my Android device?

僤鯓⒐⒋嵵緔 提交于 2019-11-26 03:53:57
问题 How can I find whether a particular package or application, say: com.android.abc , exists on my Android device? 回答1: Call any of the below method with the package name. import android.content.pm.PackageManager; // ... public boolean isPackageExisted(String targetPackage){ List<ApplicationInfo> packages; PackageManager pm; pm = getPackageManager(); packages = pm.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if(packageInfo.packageName.equals(targetPackage)) return