简体   繁体   中英

Dual apps in Android launcher

I'm creating an Android launcher. Some users have dual apps set up, eg for work (like WhatsApp with a dual sim). Now, I want to display both the default and dual instance of these apps , but only the default instance is showing (which makes sense given that I store all apps in a HashMap by their packageNames and the packageName is unique per app). I've tried searching for a solution to find the dual instance of an app, but came up empty.

I'm querying for packages through the PackageManager 's queryIntentActivities :

PackageManager packageManager = context.getPackageManager();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> allActivities = packageManager.queryIntentActivities(mainIntent, 0);

Then I retrieve the packageName from the ResolveInfo of all activities and add it to the list of apps, if it wasn't in there already. How can I find out whether an app has a second instance which should be displayed in the launcher?

It looks like this dual app feature is currently not supported for third-party launchers.

A solution we're proposing to users is to download an app like Dual Apps , Parallel Space or any other app that helps with accessing dual accounts from a different SIM.

Hopefully in the future, third party launchers will also be able to use this dual app feature by themselves.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM