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

Application.deepLinkActivated doesnt work

Discussion in 'Editor & General Support' started by raze379, Sep 16, 2020.

  1. raze379

    raze379

    Joined:
    Nov 16, 2019
    Posts:
    10
    Hello guys i want to make a deep link between chrome and my unity android app..I have done all the steps i had to do (intent filter etc.) but when i'm trying to use Application.deepLinkActivated in a specific script assigned to an empty gameobject unity give me the message "Application does not contain the definition for deepLinkActivated"..Anyone knows how to fix it ?
     
  2. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
  3. raze379

    raze379

    Joined:
    Nov 16, 2019
    Posts:
    10
    I think i have to use first Application.deepLinkActivated to activate the deep linking and after that the absoluteURL will be updated according unity documentation.Am i wrong?

    for example i use that code but the deeplinkURL is always [none] even if i launch my app by hitting a url in browser.
    if (!String.IsNullOrEmpty(Application.absoluteURL))
    {
    // Cold start and Application.absoluteURL not null so process Deep Link.
    onDeepLinkActivated(Application.absoluteURL);

    }
    // Initialize DeepLink Manager global variable.
    else deeplinkURL = "[none]";
     
    Last edited: Sep 16, 2020
  4. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    I’ll double check my deep link code at work tomorrow and get back to you with exactly what I do.
     
  5. raze379

    raze379

    Joined:
    Nov 16, 2019
    Posts:
    10
    Thank you very much,i appreciate it a lot!
     
  6. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    This is all I do:

    Code (CSharp):
    1.  
    2. void Awake()
    3. {
    4.   if( !string.IsNullOrEmpty( Application.absoluteURL ) )
    5.   {
    6.     Debug.Log( "Launched with deep link. " + Application.absoluteURL );
    7.     HandleLaunchURL( new System.Uri( Application.absoluteURL ) );
    8.   }
    9.  
    10.   Application.deepLinkActivated += OnDeepLinkActivated;
    11. }
    12.  
    13. void OnDeepLinkActivated(string link)
    14. {
    15.   Debug.Log( "Resumed with deep link. " + link );
    16.   HandleLaunchURL( System.Uri( link ) );
    17. }
    18.  
    19. void HandleLaunchURL( System.Uri link )
    20. {
    21.   // Deep link logic here
    22. }
    23.  
    And in my case my manifest looks like this:
    Code (CSharp):
    1.  
    2. <intent-filter android:label="My Game Deep Link">
    3.   <action android:name="android.intent.action.VIEW" />
    4.   <category android:name="android.intent.category.DEFAULT" />
    5.   <category android:name="android.intent.category.BROWSABLE" />
    6.   <!-- Accepts URIs that begin with "https://mysubdomain.webdomain.com/” -->
    7.  <data android:scheme="https" android:host="mysubdomain.webdomain.com" />
    8.  <data android:scheme="http" />
    9.  <data android:scheme="mygamename" android:host="play" />
    10. </intent-filter>
    11.  

    But like i said, if you override the Unity Activity then there's a good chance that the Application.deepLinkActivated event will not fire and that Application.absoluteURL will always be empty. In my case this happened when I was integrating Firebase's Activity.
     
  7. raze379

    raze379

    Joined:
    Nov 16, 2019
    Posts:
    10
    Thank you, i use something similar.The problem is my unity editor version(2019.1.14f1)..I have to upgrade it so i can use Application.deepLinkActivated.
     
  8. Afamuefuna

    Afamuefuna

    Joined:
    Sep 6, 2019
    Posts:
    13
    Hello so I think firebase is overriding my Application.absoluteURL and making it empty, what can I do?