1

I am trying to launch twitter app from my own application for sharing reason. I find facebook from link and I would like to launch twitter as well.

I used below to launch it and share my text, It launches twitter but my text is not shared.

await Windows.System.Launcher.LaunchUriAsync(new Uri("twitter:tweet?text=" + getMessageToShare(selectedAya) + ""));

The above launches Twitter App!

Any ideas, How to share text with it?

Thanks!

Community
  • 1
  • 1
ARH
  • 1,566
  • 3
  • 25
  • 56

4 Answers4

3

Unless you have avoided it purposefully, Tasks are used for such sharing purposes.

Why don't you use tasks?

See which one would suit you best:

Observe

If the user hasn't added a Twitter account to his/her phone, the status will not be shared on Twitter. The user will not be prompted to add a Twitter account either.

Mikael Dúi Bolinder
  • 2,080
  • 2
  • 19
  • 44
Gaurav Deochakke
  • 2,265
  • 2
  • 21
  • 26
  • Sadly, it seems like this is one of those distinctive features which are going away in Windows Phone 8.1. So, going forward, app to app sharing seems like the right way to do it. – akshay2000 May 20 '14 at 08:52
  • @gaurav, I want to directly open facebook / twitter app with my message in the status, but `ShareStatusTask` opens web browser which I don't want. – ARH May 21 '14 at 04:41
  • Try ShareLinkTask then. None of these ideally should open in browser. They are separate tasks. Task shows a list of options to open.. If you have twitter, facebook etc installed, ShareStatusTask will show these two in a list, where if you click on a list item there, the appropriate app will open. if you do not hav an appropriate app installed, it will open a dialog which says. Do you want to search for an app in the store and will take you to Fb or twitter on the store for download. Do verify other tasks as well. I have never seen browser opening on these task launches. Thanks and cheers – Gaurav Deochakke May 21 '14 at 06:42
  • @Guarav, If you use `ShareStatusTask` it asks you to choose the app which you like to share the message and you should login/select if you are not already logged in, but if you use the code which I shared the link in my question, It automatically launches the twitter/Facebook app. I suggest, If you have time please use the code in my link and you would understand what i want. :) – ARH May 21 '14 at 09:34
  • Yes, actually i have got what you are trying to do, but i was unaware about you not wanting to have the selection page in middle. Ill look into it. – Gaurav Deochakke May 21 '14 at 09:37
0

Here's an example of how you can share on Twitter from a Windows Phone 8 application using the ShareLinkTask.

ShareLinkTask twitter = new ShareLinkTask();

twitter.Title = "type in message here....";
twitter.LinkUri = new uri("http://www.techguybb.tk", UriKind.Absolute);
twitter.Message = "type in message here...";

twitter.Show();

Observe

If the user hasn't added a Twitter account to his/her phone, the status will not be shared to Twitter. The user will not be prompted to add a Twitter account either.

Mikael Dúi Bolinder
  • 2,080
  • 2
  • 19
  • 44
  • Thanks, this launches the twitter in web browser, It doesn't launch the twitter app which you are installing from windows phone store. I would like to launch the twitter app. – ARH May 21 '14 at 09:29
0

You just need to use the ShareLinkTask:

ShareLinkTask slt = new ShareLinkTask();
slt.Title = "You message title here";
slt.Message = "Your message goes here";
slt.LinkUri = new Uri("http://HereComesTheLinkThatWillShowInYourPost.com", UriKind.Absolute);
slt.Show();

and will post directly on social network that user selected, without need to open the app. Using the native share, user need to set a Twitter/Facebook/G+/etc account on smartphone.

Mikael Dúi Bolinder
  • 2,080
  • 2
  • 19
  • 44
  • Thanks, It doesn't directly launch the twitter/facebook app, There is a middle layer which would ask you to select your share app, It could be facebook, twitter, linkedIn and so on.. I don't want a middle tier. I want to directly launch the facebook app. please see the link i provided in my question. – ARH May 24 '14 at 03:47
  • Sorry about my mistake. You can check this link for share with facebook app [link](http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/11/14/sign-into-windows-phone-8-apps-with-facebook-login.aspx) – Leandro Muto May 26 '14 at 18:48
  • thanks, but what you are suggesting requires another package to be installed. I don't want to install another package, please check the link in my question that would give you clear idea what I want. – ARH May 27 '14 at 04:33
0

Twitter doesn't allow the deep link to post directly, so you can try to use the web api to tweet on browser use it:

await Windows.System.Launcher.LaunchUriAsync(new Uri("https://twitter.com/intent/tweet?text="+status.Text));

check this on this blog: https://somoswindev.wordpress.com/2015/06/01/postanto-no-twitter-no-windows-phone-usando-c/