How do I launch my Unity game from a URL in Android?

I’ve managed to launch my app from Safari using a custom URL type in an iOS build, and I pass that URL into the PlayerPrefs by using some code in

How can I do the same thing on an Android build, launching my app to handle a custom URL scheme, and passing that URL into PlayerPrefs?

You’ll need to use the Android intent android.intent.category.BROWSABLE.

The example Android app Photostream does this.

In its AndroidManifest.xml you can see where it sets up the intent:

    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http"
          android:pathPrefix="/photos/" />
    <data android:scheme="http"
          android:pathPrefix="/photos/" />

You can see the data being retrieved from the intent in PhotostreamActivity in the getUser function.

You can do something like this:

protected void onCreate(Bundle savedInstanceState) {
    Uri uriUsedToLaunch = getIntent().getData();