简体   繁体   中英

How to display the list of app stores installed on Android device?

I have a couple of app stores installed on my Android device, like Play Store (default), Amazon App Store , Aptoide , etc. Can someone tell me the intent that is needed to display the list of all those app stores?
When the user clicks on a link I want him to give the option to select the app store through which the app is to be downloaded. I am unable to find the intent action that would help me do this.

I finally found the answer to my own question. I used the following piece of code to display the app stores installed on the device.

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?"));
        List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(intent, 0);
        if (!resInfo.isEmpty()){
            ArrayList<String> storePacakgeNames = new ArrayList<String>();
            for (ResolveInfo resolveInfo : resInfo) {
                storePacakgeNames.add(resolveInfo.activityInfo.packageName);
            }
        }

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