'Send Parameter View Modal to App-Delegate File (Xamarain)
I am a Xamarin developer I implement app switching in my project and it's done for the android version but I don't have an idea how to do it for the IOs version
When I use the open URL function in my view controller it's working
~if(Device.RuntimePlatform == Device.iOS)
{
try{
var param = new NSDictionary();
UIApplication.SharedApplication.OpenUrl(new NSUrl("URL that want to pass"), param, (completed) =>
{});
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString(), "123456");
}
}
}~
but when the app-center built APK for the android it's failed and getting me an error cause of the UIKit library
So I want to pass the parameter(Deeplink URL) from my view modal to App-Delegate File but I am not to much aware about the xamarin so I am not able to do this
Solution 1:[1]
Take a look at Xamarin.Essentials: Launcher.
You can use Launcher class directly in Forms project to open a URI, this is often used when deep linking into another application's custom URI schemes.
Sample
var supportsUri = await Launcher.CanOpenAsync("lyft://");
if (supportsUri)
await Launcher.OpenAsync("lyft://ridetype?id=lyft_line");
In iOS 9 and greater, Apple enforces what schemes an application can query for. To specify which schemes you would like to use, you must specify LSApplicationQueriesSchemes in your Info.plist file.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>lyft</string>
<string>fb</string>
</array>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ColeX - MSFT |
