Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Launching Unity App from URI

Discussion in 'Android' started by Wahooney, Jun 3, 2014.

  1. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    Hi,

    This is something that has been asked a few times but never definitively answered:

    How does one launch an app created in Unity from a URI in Unity?

    ie. I have an app called My Awesome App

    If I try to open http://myAwesomeApp.com/?awesomeness=6001 in my browswer/email app/whatever, I would like My Awesome App to open (bonus points if you can tell me how to access the full URI in Unity.

    What I know so far is that I need to put the following XML:
    Code (XML):
    1. <intent-filter>
    2.     <action android:name="android.intent.action.VIEW" />
    3.     <data android:scheme="http" android:host="myAwesomeApp.com" />
    4. </intent-filter>
    ... somewhere in my AndroidManifest.xml.

    I've tried putting it in like this:
    Code (XML):
    1. <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
    2.     <intent-filter>
    3.         <action android:name="android.intent.action.MAIN" />
    4.         <category android:name="android.intent.category.LAUNCHER" />
    5.     </intent-filter>
    6.  
    7.     <intent-filter>
    8.         <action android:name="android.intent.action.VIEW" />
    9.         <data android:scheme="http" android:host="www.myAwesomeApp.com" />
    10.     </intent-filter>
    11.  
    12.     <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    13.     <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    14.  
    15. </activity>
    But that didn't work :(

    Code (XML):
    1. <activity android:name=".activities.AppsUrlHandlerActivity">
    2.  
    3.     <intent-filter>
    4.         <action android:name="android.intent.action.VIEW" />
    5.         <data android:scheme="http" android:host="www.myAwesomeApp.com" />
    6.     </intent-filter>
    7.  
    8. </activity>
    Neither did that.

    Any help would be greatly appreciated.
     
    Last edited: Jun 5, 2014
  2. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    I found it!

    Code (XML):
    1. <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
    2.     <intent-filter>
    3.         <action android:name="android.intent.action.MAIN" />
    4.         <category android:name="android.intent.category.LAUNCHER" />
    5.     </intent-filter>
    6.  
    7.     <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    8.     <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    9.  
    10.     <intent-filter>
    11.  
    12.         <data android:scheme="http" android:host="www.myAwesomeApp.com" />
    13.  
    14.         <action android:name="android.intent.action.VIEW" />
    15.  
    16.         <category android:name="android.intent.category.BROWSABLE" />
    17.         <category android:name="android.intent.category.DEFAULT" />
    18.     </intent-filter>
    19.  
    20. </activity>
     
  3. hollym16

    hollym16

    Joined:
    Feb 21, 2013
    Posts:
    13
    Hi, Does anyone know how to do this for iOS? @Wahooney
     
  4. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    I'm afraid I don't, try looking up Deep Linking.
     
  5. buggy_glitch

    buggy_glitch

    Joined:
    Jan 23, 2016
    Posts:
    4
    Sorry for bumping this up after ages ,i just can not seem to make it work added the android scheme as "mytestapp" and android:host="open" ,is there any other steps that i am missing ??