在Windows Phone 8.1共享合同中显示Viber,Whatsapp

时间:2014-08-18 13:13:24

标签: c# windows-phone-8.1

您好我正在开发一个在Windows Phone 8.1中通过共享合同共享图片的应用程序。我的代码是

DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);

private async void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
    DataRequest request = args.Request;
    request.Data.Properties.Title = "Unscramble this";
    request.Data.Properties.Description = "";
    request.Data.SetText(string.Format("Scrambled word is {0} and clue is {1}. Help me to unscramble this \r\n(via Unscramble Plus for Windows Phone)",scrambledString.ToUpper(),selectedMeanings.ToUpper()));
    DataRequestDeferral deferral = request.GetDeferral();

    // Make sure we always call Complete on the deferral.
    try
    {
        //StorageFile logoFile = await Package.Current.InstalledLocation.GetFileAsync("Assets\\Logo.png");

        StorageFile imagefile = await KnownFolders.PicturesLibrary.GetFileAsync("pic.png");
        List<IStorageItem> storageItems = new List<IStorageItem>();
        storageItems.Add(imagefile);
        request.Data.SetStorageItems(storageItems);
    }
    finally
    {
        deferral.Complete();
    } 
}

此处显示的股票合约如下(仅包括Facebook,Mail应用) enter image description here

但如果您在Windows Phone(http://www.windowsphone.com/en-us/store/app/sendtiment-cards/9c389cc5-5c00-4f8e-8bd4-e6fbb5040c24)的Sendtiment应用程序中看到它,它会显示许多应用程序,如Viber,Whatsapp,Twitter。

enter image description here

如何在我的应用程序的共享合同中获取这些Viber,Whatsapp之类的应用程序?

编辑:(添加)当我删除 request.Data.SetText(string.Format("Scrambled word is {0} and clue is {1}. \r\n(via Unscramble Plus for Windows Phone)",scrambledString.ToUpper(),selectedMeanings.ToUpper()));行,显示OneDrive。

enter image description here

2 个答案:

答案 0 :(得分:0)

http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1/10

这可能会有所帮助,同时也会确保您分享的是哪种数据,因为只有在内容类型匹配时,应用才会显示

例如whatsapp仅在您分享视频,图像但不是电话联系时显示。

答案 1 :(得分:-3)

如果您使用Universal-App,Whatsapp将不会显示。 WhatsApp是WP8.1 Silverlight-App。 这就是问题!