sharee.bike-App/ShareeBike/ShareeBike.Android/Model/Device/ExternalBrowseService.cs

23 lines
633 B
C#
Raw Permalink Normal View History

2022-08-30 15:42:25 +02:00
using Android.Content;
2024-04-09 12:53:23 +02:00
using ShareeBike.Droid.Model.Device;
using ShareeBike.Model.Device;
2021-11-07 19:42:59 +01:00
using Xamarin.Forms;
[assembly: Dependency(typeof(ExternalBrowseService))]
2024-04-09 12:53:23 +02:00
namespace ShareeBike.Droid.Model.Device
2021-11-07 19:42:59 +01:00
{
2022-09-06 16:08:19 +02:00
public class ExternalBrowseService : IExternalBrowserService
{
/// <summary> Opens an external browser. </summary>
/// <param name="p_strUrl">Url to open.</param>
public void OpenUrl(string p_strUrl)
{
var uri = Android.Net.Uri.Parse(p_strUrl);
var intent = new Intent(Intent.ActionView, uri);
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
intent.AddFlags(ActivityFlags.NewTask);
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
Android.App.Application.Context.StartActivity(intent);
}
}
2021-11-07 19:42:59 +01:00
}