Installed apps & "API 30 Package visibility"

Due to " Package visibility in Android 11", I can't get a list of all installed apps, not even directly querying with the package name. All connections to other apps must be set into the androidmanifest.
Many "package manager" extensions exist, but the ones which work, only work in the companion app. In the apk version, only basic apps are "shown" (calc, camera etc) thus I can't find any way to connect my apps, to check if another app is installed and which version. This is important for me because I'm developing an "app store" application, and I need to monitor which apps are installed and which version they are in, for possible updates. Would anyone say something?

tl;dr Is there some way to actually get a list of all installed apps (in API 30)? Is there some way to get the version of an installed app?

Thank you

1 Like

TaifunPM, ActivityStarter.ResolveActivity, UrsAI2AppLauncher, PkgUtils, all are limited by the Package Visibility thing.

Here is a screenshot of TaifunPackageManager aia, compiled to apk. These are all the apps that are being shown.

I believe this may only impact on devices with Android 11 +, the extensions still appear to work on Android 10 & less devices with the new AI2 targeting API 30 (only tested in companion though)

1 Like

Indeed I use Android 11. I guess something has to get updated. I also tried asking for permission QUERY_ALL_PACKAGES, but it just won't work, at first it says permission denied and afterwards it never asks again anyway. I think the permission must be declared inside the extension

App Inventor is itself now 'aimed' at API 30 (App Inventor nb187)
http://appinventor.mit.edu/ai2/ReleaseNotes.html

I think the authors of extensions need to thoroughly test them on Android 11 devices via the latest App Inventor.

2 Likes

Edit your APK with the editor APK and add this permission directly to the manifest. Google considers this a dangerous permission, the user's apps list should be confidential, and only certain types of apps will be able to claim this permission. Google will verify apps with this permission and incompatible apps will be removed from the Play Store.

See here: The limited package visibility reduces the number of apps that appear to be installed on a device, from your app's perspective.

You might want to add the permission QUERY_ALL_PACKAGES into the manifest. If you publish your app on Google Play, your app's use of this permission is subject to approval based on an upcoming policy. To add that permission into the manifest, you can use the Manifest Generator by Atom_Developer.

(answer also added in the Q&A section of the packagemanager extension)

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

I used Atom's manifest extension to add the QUERY_ALL_PACKAGES permission, but it added it in the wrong point in the manifest file. It should add it under the <manifest> tag, not under the <application>.

I tested it just in case and it didn't work :slight_smile:


It would be nice to choose the point of injection at the manifest extension.

Also the package manager could auto-require the QUERY_ALL_PACKAGES permission, because without it, it doesn't do much in android 11+ [ edit: this was wrong. QUERY_ALL_PACKAGES is not endorsed for apps that don't really need it, and they are very few. And google doesn't want it so although it works it's not good practice, it is cool for things like app managers and other apps that have a reason to be able to see all installed apps on the phone ]


As a workaround, I use TaifunFile extension to check if /android/data/package_name folder exists. This works surprisingly well, but when an app is installed, its data folder doesn't get created until the app's first launch. Also there's no way to get the version.

Hi again.

Thanks for the info, I managed to build a simple extension which just adds the QUERY_ALL_PACKAGES permission into the manifest. Works great. Here it is

QUERY_ALL_PACKAGES.aix (3.6 KB)

1 Like

Looks good!
Please explain / show blocks on how to use your extension, it doesn't appear to have anything to do with setting a permission ?

1 Like

It's on GitHub now :smile: :sunglasses: :v:

That is a different extension to the one you previously posted :wink:

It's the same. I only recompiled it to change its name.

Please explain how to use. What is integer?

The extension is a blank rush project. The simple function that it has is like "hello world". It's nothing, it's not used, it just exists as a placeholder for more code. The only thing I did was:

  1. I typed "rush create projectname"
  2. Edited the manifest (added the uses-permission line)
  3. Typed "rush build"

So the function you probably see is there by default. I just don't know if it will build without any functions so I left it there. Less work for me.

  • import aix to AI2 project
  • drag into screen to enable

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.