1

I have an app that accepts certain data from other apps. Those other apps typically check to see if my app is installed. For some reason some of those other app developers do some convoluted checks and sometimes those fail. This often leads to me getting bad reviews because those apps tell the users to install my app and they do but then it keeps telling them that because it can't find my app.

So I decompiled one of those apps and I think I found the issue. They get a list of installed apps like this:

getPackageManager().getInstalledApplications(128)

128 appears to be PackageManager.GET_META_DATA but I have no idea what that means and why my app doesn't appear on the list when that is called?

I've read on this post Android PackageManager can only detect system apps on physical devices that it could be related to package visibility on Android 11 https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9 however I tried adding that <queries> element and it didn't help at all. Is that something they need to add or something I need to add?

Edit: Figured out how the <queries> thing works. The app searching for my app must have it. So this doesn't really help me. Is there any way to get my app to show up for those apps when they query packages?

casolorz
  • 8,486
  • 19
  • 93
  • 200

1 Answers1

2

I have no idea what that means

It means that the returned data will include contents of <meta-data> elements in your manifest.

why my app doesn't appear on the list when that is called?

It is unlikely that the problem has to do with GET_META_DATA directly.

However, IIRC, those PackageManager methods are capacity-limited and may not return all results if there are too many or they are too large. In that respect, GET_META_DATA will increase the size of the response and may cause that response to be incomplete in terms of the elements in the list. If your app is missed as a result, then that would give you the behavior that you are seeing.

IOW, the real problem is that they are calling getInstalledApplications() in the first place. GET_META_DATA just makes the situation worse.

For some reason some of those other app developers do some convoluted checks and sometimes those fail

Consider supplying an SDK that handles the check, using more focused techniques than "getting the list of all installed applications along with their <meta-data> contents". Depending on the nature of your app, that SDK might also include code for checking the signature of your app to confirm it matches an expected value, so the other apps don't try communicating with some imposter or cracked version of your app.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • So I made a sample app copying their code and it had the same issue, then I added `` to the sample manifest and it worked. Seems to be something related to that or it could still be because of the size of the response? – casolorz Jul 17 '22 at 20:16
  • @casolorz: If the app doesn't have ``, then it will not work for finding most apps on Android 11+. And, they would need to fix that for using any option for detecting apps using `PackageManager` or related tools. You were asking about the possible impacts of `GET_META_DATA`, which I what I tried to answer. The concerns I raise there only matter if they have `` set up correctly, though. – CommonsWare Jul 17 '22 at 20:20
  • Thank you for the info. That explains a lot. – casolorz Jul 19 '22 at 07:09