Skip to content

Instantly share code, notes, and snippets.

@adon90
Created September 7, 2020 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adon90/c75fc33b149c9e120777c4b62809f14e to your computer and use it in GitHub Desktop.
Save adon90/c75fc33b149c9e120777c4b62809f14e to your computer and use it in GitHub Desktop.
@adon90
Copy link
Author

adon90 commented Sep 7, 2020

Manifest:

<activity android:name=".DeepLinkActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="william"></data>
            </intent-filter>
        </activity>

Code:

public class DeepLinkActivity extends AppCompatActivity {

private WebView wview;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_deep);

        Uri uri = getIntent().getData();

        wview = new WebView(this);

        wview.loadUrl("https://" + uri.getHost());
        setContentView(wview);
    }


}

ADB: adb shell am start -W -a android.intent.action.VIEW -d "william://www.hackplayers.com"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment