Deep linking with il2cpp

As part of our development, we are switching from Unity 2017.4 to Unity 2018 (and later 2019) and as part of that, we are also switching from the .net scripting backend to il2cpp. Everything is generally fine, but we were using deep linking and grabbing parameters out of the activation uri.

In c# this looks like this:

        private void ApplicationView_Activated(CoreApplicationView sender, IActivatedEventArgs args)
        {
            if (args.Kind == ActivationKind.Protocol)
            {
                var arg = args as ProtocolActivatedEventArgs;

                m_AppCallbacks.InvokeOnAppThread(
                    () =>
                    {
                        // store uri for later processing
                        UWPUtils.LaunchUri = arg.Uri;
                        OurAppNameManager.Instance.ProcessCommandArguments();
                    }, false);
            }

            CoreWindow.GetForCurrentThread().Activate();
        }

In c++, you can still get the same method as:

void App::OnActivated(CoreApplicationView^ sender, IActivatedEventArgs^ args)
{
    if (args->Kind == Windows::ApplicationModel::Activation::ActivationKind::Protocol)
    {
        Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ eventArgs =
            dynamic_cast<Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^>(args);

    }

    m_CoreWindow->Activate();
}

However, I’m kind of unfamiliar with c++ so I don’t know how to (a) create the lambda function or (b) call into my c# code. Is that even possible?

It’s possible but not by using lambda functions. It’s a little bit more involved. Check this thread out (I posted example code): how to call scripts from the xaml file in UWP IL2CPP ?