Sharing failed when running in none-debug mode RRS feed

  • Question

  •  app.onactivated = function (args) {
            if (args.detail.kind === activation.ActivationKind.launch) {
                if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
                	var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
                	dataTransferManager.addEventListener("datarequested", function (e) {
                		var request = e.request;
                		request.data.properties.title = "Share Image Example";
                		request.data.properties.description = "A demonstration that shows how to share an image.";
                		var deferral = request.getDeferral();
                		Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\smalllogo.png").then(function (thumbnailFile) {
                			request.data.properties.thumbnail = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(thumbnailFile);
                			return Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\logo.png");
                		}).done(function (imageFile) {						
                			setTimeout(function () {
                			}, 1000);
                		}, function (err) {
                } else {
                    // TODO: This application has been reactivated from suspension.
                    // Restore application state here.

    The above codes actually came from the example from Microsoft. I just added a "setTimeout" call to simulate my scenario. In my scenario, I need to do a lot of works to prepare the data for sharing, it is quite often to take more than 200 ms to complete them.

    The codes worked well in debug mode(launch from VS), while got an error ("App can't share right now, run again later") in normal mode (launch from start screen).

    It looks like there is a "Timeout" mechanism there, is it? 

    Any suggestions are welcome, and thanks in advance.



    woodhead is as woodhead does

    Tuesday, July 3, 2012 2:17 AM


All replies