How to Add a Custom URL Scheme on Android

How to Add a Custom URL Scheme on Android

Adding a custom URL scheme allows your Android app to be launched via special links such as myapp://. This is essential for enabling deep linking and guiding users directly to in-app content.

Step 1: Update AndroidManifest.xml

Locate your main activity in AndroidManifest.xml and add an intent filter to handle your custom scheme:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">

    <application
        ... >

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="myapp" android:host="{YOUR ID}.sddl.me"/>
            </intent-filter>
        </activity>

    </application>
</manifest>

This code allows your app to respond to URLs like myapp://example.com/page.

Step 2: Test the URL Scheme

  • Open a mobile browser or another app and navigate to a custom link such as myapp://demo/path.
  • Confirm your app launches and handles the path accordingly.

Make sure you add both your development and production host settings in the SDDL dashboard to ensure full support across environments.