xamarin how to open facebook and twitter app from

2019-06-24 21:49发布

i'm developing a ios app with xamarin, in c#. I have a "contact" UIViewController, with some buttons, including Facebook and Twitter.

I need to open Facebook and Twitter App from my app, that points to a specific Facebook Page and Twitter profile.

Which is the best way to do this?

Thanks in advance...

2条回答
一纸荒年 Trace。
2楼-- · 2019-06-24 22:41

Try this :

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

For page_id right click on page and select view source page and find the page_id for facebook and same as for twitter find the userid

查看更多
何必那么认真
3楼-- · 2019-06-24 22:48

In addition to accepted answer, following are my finding to open links in external applications.
To open link in browser:

Device.OpenUri(new Uri("http://example.in/index.html"));

To open group in facebook:

Device.OpenUri(new Uri("fb://group/groupname"));

To open page in facebook:

Device.OpenUri(new Uri("fb://page/page_id"));

To open user in instagram:

Device.OpenUri(new Uri("instagram://user?username=yourUserName"));

To open user in twitter:

Device.OpenUri(new Uri("twitter://userName?user_id=userId"));

To open mail app:

Device.OpenUri(new Uri("mailto:example@gmail.com"));

查看更多
登录 后发表回答