You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Sebastien Lorber (JIRA)" <ji...@apache.org> on 2016/10/03 17:41:20 UTC
[jira] [Commented] (CB-11924) Share target: sharing to cordova app
makes the app open but crashes afterwards
[ https://issues.apache.org/jira/browse/CB-11924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15542948#comment-15542948 ]
Sebastien Lorber commented on CB-11924:
---------------------------------------
Hi,
I'm sorry to ask again but can someone give me any early feedback on this issue? Even if it's a first unqualified impression I'll take it!
I'm participating a Microsoft/HP hackaton for the launch of HP Elite X3 and have to ship my app in 2 days to qualify. This feature is very important for us and I can't make it work. I'm supposed to get support from Microsoft but I'm not sure they expected us to have a Cordova app so couldn't get much help.
I know it's not really cool to ask people doing OS to fix my own problems when I can do it myself, but I don't have any other solution here :)
I'm following Microsoft / Cordova docs, using latest code I find and master branches, also trying to read/modify source code. Any hint so that I can fix the problem myself (and contribute back) would be helpful because I'm not a Windows Phone expert and won't have time to become one in 2 days :'(
My current test code is based on the Cordova template project, on which I only modified the index.js file:
{code}
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.receivedEvent('deviceready');
setupShareTarget();
},
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
};
app.initialize();
function setupShareTarget() {
console.debug("setupShareTarget");
var shareOperation = null;
function shareReady(args) {
console.debug("shareReady");
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.uri)) {
console.debug("shareOperation");
shareOperation.data.getUriAsync().done(function (uri) {
console.debug("getUriAsync");
});
}
}
WinJS.Application.onactivated = function (args) {
console.debug("onactivated");
if (args.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
console.debug("launch");
args.setPromise(WinJS.UI.processAll());
}
else if (args.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.shareTarget) {
console.debug("share target");
args.setPromise(WinJS.UI.processAll());
shareOperation = args.detail.shareOperation;
WinJS.Application.addEventListener("shareready", shareReady, false);
WinJS.Application.queueEvent({ type: "shareready" });
}
else {
console.debug("else");
}
};
}
{code}
https://gist.github.com/slorber/ea1e77f78192eb2832f4ce9fdd5eb7bc
onactivated is triggered when app start and is reopened, but does not trigger when we share a browser link (+ emulator crashing)
Any idea of anything I could be doing wrong?
Thanks
> Share target: sharing to cordova app makes the app open but crashes afterwards
> ------------------------------------------------------------------------------
>
> Key: CB-11924
> URL: https://issues.apache.org/jira/browse/CB-11924
> Project: Apache Cordova
> Issue Type: Bug
> Components: Windows
> Affects Versions: 4.4.2
> Environment: Windows 10, cordova cli 6.1.1, affects cordova platform 4.4.2, also current 4.5.0 dev branch.
> Reporter: Sebastien Lorber
>
> Steps to reproduce:
> ========================
> {code}
> cordova create shareTargetTest
> cd shareTargetTest
> cordova platform add https://github.com/apache/cordova-windows
> {code}
> In manifest, add Share Target of type URI, leading to the following XML:
> {code}
> <Extensions>
> <uap:Extension Category="windows.shareTarget">
> <uap:ShareTarget>
> <uap:DataFormat>URI</uap:DataFormat>
> </uap:ShareTarget>
> </uap:Extension>
> </Extensions>
> {code}
> Run Windows 10 emulator (also crashed on HP Elite X3 device)
> Open Edge browser on any page, and share page to HelloCordova app.
> The HelloCordova app opens, and after some seconds, the emulator crashes (WWAHost.exe fails with code = -1: don't know how to get more details unfortunatly)
> --------------------------------------------------------------------------
> Expected result:
> ========================
> I don't know if this has ever been done by anyone on a Cordova app, but I want to share a Edge link to my application. For Android/iOS, this means that the app should open, or resume itself, and call some JS callback.
> I tried to follow these Windows8 tutorials that still look relevant for Windows10 app, with no success.
> https://msdn.microsoft.com/en-us/library/windows/apps/hh758301.aspx
> It seems the "activated" callback never fires (weither it's declared in my app, or in cordova.js, at least I don't see anything in the console logs I've put everywhere).
> Can you tell me if I do anything wrong to achieve this usecase? thanks
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org