Deep linking windows confussion

Eduardo Gomez 3,671 Reputation points
2024-01-19T21:14:31.89+00:00

I need to be able to open my app, when I receive a link in the mail (like Microsoft team)

I already searched everywhere how to do this, and I was able to do somethig

In the pakage.manifest, I registered

	<Extensions>
		<uap:Extension Category="windows.protocol">
			<uap:Protocol Name="demy-ia.daily.co">
				<uap:Logo>images\icon.png</uap:Logo>
				<uap:DisplayName>Your App Name</uap:DisplayName>
			</uap:Protocol>
		</uap:Extension>
	</Extensions>


reading Microsoft documentation https://learn.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation

 <Applications>
        <Application Id= ... >
            <Extensions>
                <uap:Extension Category="windows.protocol">
                  <uap:Protocol Name="alsdk">
                    <uap:Logo>images\icon.png</uap:Logo>
                    <uap:DisplayName>SDK Sample URI Scheme</uap:DisplayName>
                  </uap:Protocol>
                </uap:Extension>
          </Extensions>
          ...
        </Application>
   <Applications>

So, the protocol of my app is https://demy-ia.daily.co/ The Logo I don't have a logo. And the displayName is the name of my app witch id DemyAI, but it doesn't work. since all my meetings start with https://demy-ia.daily.co/

#if WINDOWS
                    events.AddWindows(windows => windows
                            .OnLaunched((window, args) => {

                                var commandLineArgs = Environment.GetCommandLineArgs();
                            }));
#endif

And when I explore the variables, I don't see anything, and I need to navigate to a certain page with the url.User's image For example: I have joinMeetingPage, and I want to navigate there, carrying the URL, to put it in a WebView
but I cannot get the URI, however if I open cmd and put

start demy-ia.daily.co://pSrMtpMvYPunT78inEvj


it will open my app
User's image

User's image

Developer technologies | .NET | .NET MAUI
{count} votes

Accepted answer
  1. Anonymous
    2024-01-23T03:08:37.21+00:00

    Hello,

    Firstly, please right-click the Package.appxmanifest file, open with HTML Editor. I add following name-prefix to do it.

     <Applications>
          <Application Id="App" ...> 
    
    ...         
             <Extensions>
                  <uap:Extension Category="windows.protocol">             
                      <uap:Protocol Name="demy-ia">                      
                          <uap:DisplayName>demy-ia</uap:DisplayName>
                      </uap:Protocol>
                  </uap:Extension>
              </Extensions>
         </Application>
      </Applications>
    

    We can get url by appActivationArguments.Uri, before get the url, we need use Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs(); to get appActivationArguments.

    Please change the events like following code.

        .ConfigureLifecycleEvents(events =>
                    {
    #if WINDOWS
                        events.AddWindows(windows => windows
                                .OnLaunched((window, args) => {
                                    
                                    var activatedEventArgs = Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs();
                                   
                                    Windows.ApplicationModel.Activation.ProtocolActivatedEventArgs appActivationArguments =activatedEventArgs.Data as Windows.ApplicationModel.Activation.ProtocolActivatedEventArgs;
    
    
                                   if (appActivationArguments != null)
                                    {
                                        var uri = appActivationArguments.Uri;
                                    }
                                   
                                }));
    #endif
    
    
                   })
    

    Here is my tested url demy-ia://Addyourtestmeeting, if you put this URL in the browser and access it, you will get a popup window to open your application.

    By the way, if you want to use https://demy-ia.daily.co/dedwdewdewdew to do the deep linking. Please Handle the Redirect from Web URL to Custom URI Scheme:

    On the web server, configure a redirect from https://demy-ia.daily.co/dedwdewdewdew to demy-ia://Addyourtestmeeting.

    Best Regards, Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.