locked
Sharing with DataTransferManager : Getting Info from App RRS feed

  • Question

  • Hi All,

    I am trying to share some text with facebook through DataTransferManager. When I clicked on the Share button the share charm appears, but it keeps saying "Getting Info from App". Nothing happens.

    Any ideas?

    Thanks.


    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    Tuesday, June 18, 2013 5:46 PM

Answers

All replies

  • When I am running through the Visual Studio it keeps saying "Getting Info from App".  When I run the app from from the start menu, it says something went wrong?

    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    Tuesday, June 18, 2013 5:49 PM
  • Please post some working code so that one can understand what went wrong. Key things are how do you register for data request (when, where and how). Who handles your request (what type of class, function)? does it ever hit the handler when you run from visual studio? What type of data are you sharing?

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Tuesday, June 18, 2013 6:11 PM
  •     public sealed partial class MainPage : Page
        {
            private DataTransferManager dataTransferManager;
            
            public MainPage()
            {
                this.InitializeComponent();
            }
    
            protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                this.dataTransferManager = DataTransferManager.GetForCurrentView();
                this.dataTransferManager.DataRequested += dataTransferManager_DataRequested;
            }
    
            protected override void OnNavigatedFrom(NavigationEventArgs e)
            {
                this.dataTransferManager.DataRequested -= dataTransferManager_DataRequested;
            }
    
            void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                GetShareContent(args.Request);
            }
    
            private void ShareClick_Event(object sender, RoutedEventArgs e)
            {
                DataTransferManager.ShowShareUI();
            }
    
            private void GetShareContent(DataRequest request)
            {
                DataPackage requestData = request.Data;
                requestData.Properties.Title = "Test";
                requestData.Properties.Description = "";
                requestData.SetUri(new Uri("http://www.google.com"));
            }
        }


    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    Tuesday, June 18, 2013 6:13 PM
  • Hi Vishal,

    dataTransferManager_DataRequested event never get called.


    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    Tuesday, June 18, 2013 6:14 PM
  • This might have happened if you stopped debugging while Share contract was active.

    To solve this you can do two thing. Either reset your computer (100% works) or go to task bar and restart/kill explorer (if your kill it, then reopen it with WIN+R, type explorer and press ENTER).

    I hope this works for you.

    PS: This a blog post of a friend who had same problem and wrote a solution for this problem:

    http://tozon.info/blog/post/2012/12/04/Share-charm-stopped-working-while-debugging-Windows-Store-app.aspx

    Tuesday, June 18, 2013 8:43 PM
  • Hi,

    I couldn't try restarting the machine, but I tested this on a another machine. It is working nicely. Should check with my dev laptop once I get back home.

    Thanks for the answers.


    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    Wednesday, June 19, 2013 5:14 AM
  • Hi i'm also trying to Share content to Facebook using DataTransferManager,

    i'm able to share any Image or Video without any Title for that image or video. i need to share an Image with a Title. I tried this code to share Image,

     public async static Task<bool> GetShareContent(DataRequest request, MediaItem MediaItem, StorageFile file)
            {
                List<IStorageItem> files = new List<IStorageItem>();
                files.Add(file);
                bool succeeded = false;

                string dataPackageText = "Text to Share";
                if (!String.IsNullOrEmpty(dataPackageText))
                {
                    DataPackage requestData = request.Data;
                    requestData.Properties.Title = "Windows Phone Share Option";
                    requestData.Properties.Description = "Test For Uma"; // The description is optional.
                    requestData.SetText("Sarevesh Test");
                    //For Files
                    requestData.SetStorageItems(files);

                    succeeded = true;
                }
                else
                {
                    request.FailWithDisplayText("Enter the text you would like to share and try again.");
                }
                return succeeded;
            }

    even Title i'm setting, but only Image i posting on Facebook wall with out any Title.

    please help me.

    Thanks and Regards.

    Friday, June 27, 2014 7:51 AM