Xamarin.iOS app responses on any URL using deep linking?

Yongqing Huang 241 Reputation points
2022-03-27T21:18:46.41+00:00

Hi,
I have developed Xamarin.Andriod app, a sort of custom browser using WebView. De app is in the list of browsers after installation. User can set it as a default browser. It will launch when an URL in email or SMS is clicked.
I used deep linking:
[IntentFilter(new[] { Android.Content.Intent.ActionView },
Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryLauncher, Android.Content.Intent.CategoryBrowsable },
AutoVerify = true,
DataSchemes = new[] { "http", "https"}
)]
Entry in OnAppLinkRequestReceived(Uri uri) when any URL clicked.

I tried to develop the Xamarin.iOS version of this custom browser.

The following example is not ok:

https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/deep-linking
Add an Apple App Site Association file to your website.

Because my app will response any URL/website, not a limited websites.

Could you advice my how to develop such a Xamarin.iOS custom browser?

Thanks in advance!

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2022-03-28T04:12:39.633+00:00

    Hello,

    Using Universal Links need the following prerequisites :

    1. You must have a corresponding website (have a domain name) for your app and the ability to upload a file to it.
    2. Find your App ID in https://developer.apple.com/account/resources/identifiers/list, enable Associated Domains under Capabilities
    3. Find Associated Domains in Entitlements.plist of your iOS project, fill in the domain name you want to support in Domains, which must be prefixed with applinks:
    4. Create a file in JSON format, the file name must be apple-app-site-association
    5. Upload the file to your website

      my app will response any URL/website, not a limited websites.

    You could check the path in the JSON file in step4, only the links of the specified paths can be processed by the app. If you fill in *, it represents all links.

    {  
      "applinks": {  
        "details": [  
          {  
            "appIDs": [  
              "ABCDE12345.com.example.app",  
              "ABCDE12345.com.example.app2"  
            ],  
            "paths": [  
              "*"// replace * with your path  
            ]  
          }  
        ]  
      }  
    }  
    

    Then you could use OnAppLinkRequestReceived method to check if the received Uri is intended for the application.

    For more details, you could refer to
    https://developer.apple.com/documentation/Xcode/supporting-associated-domains
    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/deep-linking#responding-to-a-deep-link
    https://developer.apple.com/ios/universal-links/
    https://developer.apple.com/documentation/xcode/allowing-apps-and-websites-to-link-to-your-content

    Could you advice my how to develop such a Xamarin.iOS custom browser?

    If you want to configure your browser app so that users can set it as the default on their device instead of Safari, refer to
    https://developer.apple.com/documentation/xcode/preparing-your-app-to-be-the-default-browser-or-email-client

    Best Regards,
    Wenyan Zhang


    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.


0 additional answers

Sort by: Most helpful

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.