locked
Sharing: multiple data formats priority? RRS feed

  • Question

  • We have an app where we are sharing the same piece of content in multiple formats, but is there a way to set a priority of which wed like taken first? For example we are sharing a link and an html format...but we want apps to take the HTML format when they can and if not fallback to the link. Is this possible?

    void DetailPage_DataRequested( DataTransferManager sender, DataRequestedEventArgs args )
            {
                args.Request.Data.Properties.Title = r.Title;
    
                if( !string.IsNullOrEmpty( r.Description ) )
                    args.Request.Data.Properties.Description = r.Description;
    
                args.Request.Data.SetDataProvider( StandardDataFormats.Html, new DataProviderHandler( ShareHtmlRequest ) );
                args.Request.Data.SetDataProvider( StandardDataFormats.Uri, new DataProviderHandler( ShareUriRequest ) );
            }

    Seems like you can respond to a specific app, but thats not really what we want to do...we want apps that are capable of taking both to take 1 first. For example the Mail app seems to take URIs over HTML even though it supports both.

    Tuesday, July 24, 2012 4:44 AM

Answers

  • There is no priority from the share source's point of view: the target can choose which data types to use in whichever order makes the most sense for it. It is 100% up to the share target to pick the format to use.

    The share source doesn't get any communication back from the target about data types.

    --Rob

    • Marked as answer by Min ZhuMember Saturday, August 11, 2012 7:37 AM
    Tuesday, July 24, 2012 4:38 PM
    Moderator

All replies

  • Hi,

    The above scenario seems to be under the control of the Share Target app. So, even if you specify the priority in the Share Source , the Share Target could still override it. 

    -Sagar

    Tuesday, July 24, 2012 2:35 PM
  • So is there a notion of priority? For example is the order you call SetDataProvider some sense of priority, or is it 100% up to the apps to pick the format they want in the order they want to check for them?

    If one were to try to respond by app type for example, is there a way to see which formats an app supports and then return them the one we want, or is there really no way to do what we are describing?

    Thanks!

    Tuesday, July 24, 2012 3:40 PM
  • There is no priority from the share source's point of view: the target can choose which data types to use in whichever order makes the most sense for it. It is 100% up to the share target to pick the format to use.

    The share source doesn't get any communication back from the target about data types.

    --Rob

    • Marked as answer by Min ZhuMember Saturday, August 11, 2012 7:37 AM
    Tuesday, July 24, 2012 4:38 PM
    Moderator
  • Ok thanks, so sounds like there is no way to do what we want. We want HTML to be shared via email, and a link to be shared on things like Twitter and Facebook.

    Tuesday, July 24, 2012 5:04 PM