Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1K
Views
Linking.canOpenURL returning false when targeting android 30 sdk on React Native

Recently switched our build targets to android 30 to add support for Android 11, now directions and call for phone are not working.

The documentation mentions deep linking natively and or the use of an npm package. Would this be done natively? Or is the package an option?

https://reactnative.dev/docs/linking

Linking.canOpenURL is now returning false when checking if it is supported when running android 30.

Linking.canOpenURL(url)
.then((supported: boolean) => (supported ? Linking.openURL(url) : Alert.alert("Error", "There was an error attempting to opening the location.")))
.catch(() => Alert.alert("Error", "There was an error attempting to opening the location."));
over 4 years ago · Santiago Trujillo
4 answers
Answer question

0

By adding this in manifest resolved the issue

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

Thank you everyone for your support.

over 4 years ago · Santiago Trujillo Report

0

Take care if you decide to use

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

google says:

Permitted use involves apps that must discover any and all installed apps on the device, for awareness or interoperability purposes may have eligibility for the permission. Permitted use includes device search, antivirus apps, file managers, and browsers. Apps granted access to this permission must comply with the User Data policies, including the Prominent Disclosure and Consent requirements, and may not extend its use to undisclosed or invalid purposes.

on policy update from Google Play

over 4 years ago · Santiago Trujillo Report

0

The answer lies in a new Android security feature: Package Visibility. This works similar to iOS' LSApplicationQueriesSchemes.

Targeting Android 11 (SDK 30) requires you to update your AndroidManifest.xml and include a list of applications you're querying for. E.g. here's the code I'm using to check for Google Maps navigation in my own app. It also includes permissions for HTTP and HTTPS:

<manifest package="com.example.game">
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="http"/>
    </intent>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="https"/>
    </intent>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="geo" />
    </intent>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="google.navigation" />
    </intent>
  </queries>
  ...
</manifest>

For applications matching certain criterias (such as Antivirus apps, file managers, or browser) you can use the QUERY_ALL_PACKAGES permission to allow querying any random package similar to earlier Android versions:

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

However, be aware that your application will be rejected from Google Play if you don't qualify as any of the app types listed below or uses the QUERY_ALL_PACKAGES in an unauthorized way:

Permitted use involves apps that must discover any and all installed apps on the device, for awareness or interoperability purposes may have eligibility for the permission. Permitted use includes device search, antivirus apps, file managers, and browsers. Apps granted access to this permission must comply with the User Data policies, including the Prominent Disclosure and Consent requirements, and may not extend its use to undisclosed or invalid purposes.

See Use of the broad package (App) visibility (QUERY_ALL_PACKAGES) permission

over 4 years ago · Santiago Trujillo Report

0

In my case I needed to add a android:host="*" to the data tag like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.acme">
...
    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https" android:host="*" />
        </intent>
    </queries>
</manifest>

For Linking.canOpenURL(url) to return true for https://... URLs.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!