[Solved] Launch URL doesn't work in Android for SDK target 30

Okay so I was looking into this in a bit more detail. As others already wrote, adding the android.permission.QUERY_ALL_PACKAGES works, but is definitely not recommended.

The easiest way of solving this is to upgrade the project to 4.27. With 4.27 the following commit fixes this issue for SDK target 30: https://github.com/EpicGames/UnrealEngine/commit/e49afc395b171e1d0c39e2d79b16ca2be8ea982c

In case upgrading isn’t an option for some reason, there are 2 things that are required additionally to make launching URLs work for SDK target 30 without adding the QUERY_ALL_PACKAGES permission:

As described here, the android manifest file needs to be extended to properly handle queries to intents of other apps - like when opening a link in a browser.
This can be done using a UPL file to edit the manifest, as this file is assembled while packaging the project. A neat explanation of how to create and use such a file to modify the manifest can be found here
For the UPL file use this content to add the required lines to the manifest:

<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android">
    <androidManifestUpdates>
        <addElements tag="manifest">  
          <queries>
            <intent>
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.BROWSABLE" />
              <data android:scheme="http" />
            </intent>
            <intent>
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.BROWSABLE" />
              <data android:scheme="https" />
            </intent>
          </queries>
        </addElements>
    </androidManifestUpdates>
</root>

In addition to that, you need to use a source build of the engine to add the following to line 4204 in Engine/Build/Android/Java/src/com/epicgames/ue4/GameActivity.java.template:

BrowserIntent.addCategory(Intent.CATEGORY_BROWSABLE);

You can check the above linked github commit to see the full code and where the above shown line needs to be added exactly.

2 Likes