Posts

Showing posts from May, 2015

Android: Multiple instances of Launcher activity with PackageManager's queryIntentActivities

   Android's customization lets users download and install custom launchers starting from AOSP's Launcher2 or Launcher3 and even Google Now. One of the tasks for Launcher developers is to figure out the installed applications and create launch intents as and when users need them. Android's Package Manager helps in querying installed applications and one such API is  queryIntentActivities .     Here is a utility that app developers can use to find the Launch intent for a particular package.     private Intent launchApp( String packageName )     {         Intent intentToResolve = new Intent(Intent.ACTION_MAIN);         intentToResolve.addCategory(Intent.CATEGORY_INFO);         intentToResolve.setPackage( packageName );         List<ResolveInfo> ris = queryIntentActivities(intentToResolve, 0);         // Otherwise, try to find a ...