Start a new topic

How to define ArchitectUrlListener in C#?

How to define ArchitectUrlListener in C#?


Is it possible to provide a sample code on how to define the ArchitectUrlListener in C#/Xamarin? I could not find it anywhere, the sample projects come with the SDK miss that part, thanks!

Hi Richard,
Simply derive any class from `ArchitectView.IArchitectUrlListener` and implement

```
public bool UrlWasInvoked(string url)
        {
            Console.WriteLine("invoked url: " + url);
            return true;
        }

```
Set an instance of this class as the url listener of your ArchitectView using the `RegisterUrlListener` method (`architectView.RegisterUrlListener(*the object which class derices from ArchitectView.IArchitectUrlListener *);`). Done!

Best regards,

Andreas

Thanks a lot for the prompt response! I made it work as suggested. Also found the sample projects here: https://github.com/Redth/Wikitude.Xamarin/tree/master/source/samples/Android/WikitudeSampleAndroid

Hi Richard,
Nice that it works.
The samples you refer to are not officially maintained from us but a good starting point. We will write/improve them in the future so that Xamarin has similar examples like all other extensions that we support.

Best regards,

Andreas
Login or Signup to post a comment