Xamarin Forms: How to open an app from another app?

前端 未结 2 597
生来不讨喜
生来不讨喜 2021-01-21 23:29

I have 2 applications ( A and B ) developed using Xamarin.Forms. I need to open app A from app B.

I have tried like below as per this thread:

In the view

2条回答
  •  伪装坚强ぢ
    2021-01-21 23:46

    Have you tried using Xamarin Essentials : Xamarin.Essentials: Launcher

       public class LauncherTest
    {
        public async Task OpenRideShareAsync()
        {
            var supportsUri = await Launcher.CanOpenAsync("lyft://");
            if (supportsUri)
                await Launcher.OpenAsync("lyft://ridetype?id=lyft_line");
        }
    }
    

    Or

    Device.OpenUri(new Uri("fb://page/page_id"));
    
    Device.OpenUri(new Uri("twitter://user?user_id=userid"))
    

    don't forget to use the correct package name when opening specific apps

提交回复
热议问题