Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on Android 10 onwards #151

Open
niyasali64 opened this issue Feb 22, 2023 · 3 comments
Open

Not working on Android 10 onwards #151

niyasali64 opened this issue Feb 22, 2023 · 3 comments

Comments

@niyasali64
Copy link

SendIntentAndroid.isAppInstalled("com.myapp2").then(isInstalled => {
    console.log('is Installed---->', isInstalled)
    if (isInstalled) {
        SendIntentAndroid.openApp("com.myapp2", {
            "com.myapp2.reason": "just because",
            "com.myapp2.data": "must be a string",
        }).then(wasOpened => {
            console.log('wasOpened------->', wasOpened)

        });
    }
    else {
        Linking.openURL(
            'https://play.google.com/store/apps/details?id=com.myapp2',
            );
    }
});

The App2 is installed, Working on up to Android 9.
But afterward not working, it is going to the play store link,

@SaGaR1084
Copy link

SaGaR1084 commented Mar 2, 2023

@niyasali64 Can you please try this in AndroidManifest.xml it's working for me after adding this

 <queries>
        <package android:name="com.test.yourapp" />
 </queries>

@joao-gabriel-gois
Copy link

I'm facing the same.
isInstalled is returning false for known installed apps.

@1mike12
Copy link

1mike12 commented Feb 11, 2024

From GPT4 summarizing something that I loosely remembered:

starting with Android 10 (API level 29), Google introduced additional restrictions and changes regarding privacy and how apps can interact with other apps installed on the same device. One of the key changes affects an app's ability to query the presence of other apps on the device. This change was implemented as part of Android's ongoing efforts to enhance user privacy.

Querying Installed Apps Restriction

Before Android 10, apps could freely query the list of installed apps on a device. This capability could be used for various purposes, such as checking for the presence of companion apps, competitive analysis, or feature enhancement based on available apps. However, this could also potentially be exploited to gather information about the user without their knowledge.

With Android 10, Google restricted this capability. Apps now need to declare specific permissions in their manifest file to query installed apps. Specifically, apps must declare the QUERY_ALL_PACKAGES permission in their AndroidManifest.xml file to query any app that's installed on the device, not just those that they can interact with directly.

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

Implications

  • Privacy Enhancement: This change improves privacy by ensuring that an app cannot discover all other apps the user has installed without explicit permission, thus limiting unnecessary or invasive data collection.
  • Limited Visibility: Apps can only query the information about other apps that are directly related to its operation unless they have the QUERY_ALL_PACKAGES permission, which is subject to Google Play's policy restrictions and review.
  • Google Play Restrictions: Google Play imposes strict guidelines on the use of the QUERY_ALL_PACKAGES permission, limiting its use to apps that have a core need to discover any apps installed on the device for their functionality. Apps that request this permission without a valid use case may be rejected from the Google Play Store.

Best Practices

Developers are encouraged to minimize their use of the QUERY_ALL_PACKAGES permission and only request it when absolutely necessary for the app's function. Instead of querying all apps, developers can use more specific intents and queries for interacting with other apps, such as using Intent filters to discover apps that can perform a specific action (e.g., opening an email client) without needing to know all apps installed on the device.

For opening an email client, as discussed earlier, using an intent with the action Intent.ACTION_SENDTO and a mailto URI (mailto:) is a privacy-friendly approach that doesn't require querying installed apps and is compliant with Android 10's privacy enhancements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants