#Getting the deep link the app was opened with

1 messages · Page 1 of 1 (latest)

slate pond
#

Hi,

I can't find any documentation on this, but I have deep links working, but it'll only get the event if the app was opened before. Is it possible to query if the app was opened with a certain link?

frozen goblet
slate pond
#

Yes, we subscribe to both

#

But if the app was fully closed, the event doesn't trigger, does it?

frozen goblet
slate pond
#

Android

#

I'd have to double check, but I think it happens on iOS as well

slate pond
frozen goblet
#

We schdeuled a test tomorrow to look into.
Ideally, the event should get fired when the app opens from the link once it's clicked.

#

I see you are expecting it right. Just need to double check in my test why it's failing to fire the event.

slate pond
#

@frozen goblet Any update on this?

frozen goblet
#

Hi! Let me jump into it right now.

#

Are you using scheme or app link/universal link?

frozen goblet
#

@slate pond I can reproduce the issue on my end. Let me find out the cause and get you a fix.

slate pond
#

Thanks!

slate pond
frozen goblet
#

Where are you registering the event?

slate pond
#
    public abstract class DeeplinkHandler : SerializedMonoBehaviour
    {
        [SerializeField]
        [InfoBox("Should always start with /")]
        private string _path = "/path";

        private void OnEnable()
        {
            DeepLinkServices.OnCustomSchemeUrlOpen += TryExecute;
            DeepLinkServices.OnUniversalLinkOpen += TryExecute;
        }

        private void OnDisable()
        {
            DeepLinkServices.OnCustomSchemeUrlOpen -= TryExecute;
            DeepLinkServices.OnUniversalLinkOpen -= TryExecute;
        }

        private void TryExecute(DeepLinkServicesDynamicLinkOpenResult result)
        {
            Debug.Log("Executing deep link: " + result.Url.AbsolutePath);
            if (_path != result.Url.AbsolutePath) return;
            
            Debug.Log("Handle deep link : " + result.Url);
            string query = result.Url.Query;
            NameValueCollection parsedQuery = HttpUtility.ParseQueryString(query);

            ExecuteAction(parsedQuery);
        }
        
        protected abstract void ExecuteAction(NameValueCollection query);
    }
#

OnEnable / OnDisable

frozen goblet
frozen goblet
slate pond
#

I'll have a look in a moment, thanks!

slate pond
#

@frozen goblet We're getting some errors, but let me check what version we're on

#

We're still on 2.6.1. Let me update

slate pond
#

That fixes it, thank you @frozen goblet!

frozen goblet
#

Hey @slate pond
If you don't mind, can you please share how you are using deep links feature in your product?

slate pond
#

@frozen goblet We have a walking app where we let towns make walks for people to walk around. We have a back-end platform where they can make the walks. They can use a deep link with a QR code to test the walk before putting it live on the app