How can I configure Launcher activity programmatically in android?

Is there any way of switching between Launcher Activities programmatically on basis of saved preferences ? You can try this: Step #1: Have LoginActivity have the LAUNCHER <intent-filter> as normal, and have MainActivity have no <intent-filter>. Step #2: Have an <activity-alias> element in the manifest pointing to MainActivity that has the LAUNCHER <intent-filter>. Step #3: … Read more

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

PackageManager pm = mcontext.getPackageManager(); List<PackageInfo> list = pm.getInstalledPackages(0); for(PackageInfo pi : list) { ApplicationInfo ai = pm.getApplicationInfo(pi.packageName, 0); System.out.println(“>>>>>>packages is<<<<<<<<” + ai.publicSourceDir); if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { System.out.println(“>>>>>>packages is system package”+pi.packageName); } }

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

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(String targetPackage){ PackageManager pm=getPackageManager(); try { PackageInfo info=pm.getPackageInfo(targetPackage,PackageManager.GET_META_DATA); } catch … Read more