0

I would like to list all application supported with multi-window. I have a function that list all installed app, but I cannot figure out how to check if an app supports multi-window. Can anyone help me, pls?

fun getApplicationsInfo(context: Context): MutableList<ApplicationInfo> {
            val apps: MutableList<ApplicationInfo> = ArrayList()
            val intent = Intent(Intent.ACTION_MAIN, null)
            intent.addCategory(Intent.CATEGORY_LAUNCHER)
            val pm: PackageManager = context.getPackageManager()
            val activities = pm.queryIntentActivities(intent, 0)
            Collections.sort(activities, ResolveInfo.DisplayNameComparator(pm))
            for (ri in activities) {
                val info = ApplicationInfo()
                
                info.topApp = ri.activityInfo.packageName as String
                info.bottomApp = ri.activityInfo.packageName as String
                info.tIcon = ri.activityInfo.loadIcon(pm)
                info.bIcon = ri.activityInfo.loadIcon(pm)
                apps.add(info)
            }
            return apps
        }
˙˙˙`
Dodo
  • 121
  • 1
  • 9
  • How do you wish to define "supports multi-window"? – CommonsWare Oct 31 '20 at 15:54
  • for example in Android there are apps that you can use in split screen mode. – Dodo Oct 31 '20 at 17:24
  • On modern versions of Android, that is the vast majority of apps. So, again: how do you wish to define "supports multi-window"? – CommonsWare Oct 31 '20 at 18:05
  • Sorry, but I am not sure that I understand your question. I need to list of all application that I can use in split screen mode. Currently I can list of all installed app as you can see on function getApplicationsInfo(). But it is not really good, because for example there are apps that I cannot use in split screen mode. That is what I would like to solve. I would not like to see these apps in the list. – Dodo Nov 01 '20 at 08:59
  • "I need to list of all application that I can use in split screen mode" -- that is a list of all apps. "there are apps that I cannot use in split screen mode" -- we cannot tell you exactly why that is the case. Some of those apps might have an activity that has [`resizeableActivity`](https://developer.android.com/guide/topics/ui/multi-window?hl=en#resizeableActivity) set to `false`. Technically, they still do support split-screen; it is just harder to get them started in that mode. Also, I do not see where we can find the value of `resizeableActivity` in `ActivityInfo`, which is annoying. – CommonsWare Nov 01 '20 at 11:33

0 Answers0