Closed T-M-C closed 10 years ago
I'm not sure I understand what you are looking for the invoked event to do? Can you provide some more details?
i am listening if the app was invoked by the share card/system. like down here at "invoked": https://developer.blackberry.com/html5/apis/beta/blackberry.invoked.html
<script type="text/javascript">
function onInvoked(onInvokedInfo) {
if(onInvokedInfo.source) {
console.log("Source: " + onInvokedInfo.source);
}
if(onInvokedInfo.target) {
console.log("Target(me): " + onInvokedInfo.target);
}
if(onInvokedInfo.action) {
console.log("Action: " + onInvokedInfo.action);
}
if(onInvokedInfo.data) {
console.log("Data: " + onInvokedInfo.data);
//the data comes in as a base64 string you can convert it using atob(...)
//note that atob will fail if you are being passed unicode strings
console.log("Data: " + atob(onInvokedInfo.data));
}
}
document.addEventListener("invoked", onInvoked);
</script>
(my app is processing images from the sharemenu - it just works, but want to inform you about the error :-) ) it throws the error before i do anything with the callback etc. just try to use the console and set the listener like "document.addEventListener('invoked',onInvoked);"....
Can you post your code on where you are initializing the bbUI toolkit when you receive an invoke?
in the index -> loadInvokelistener();
...
<link rel="stylesheet" href="bbui/bbui.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="bbui/bbui.js" type="text/javascript"></script>
<script src="local:///cordova.js" type="text/javascript" ></script>
<script src="js/app.js"></script>
...
<script type="text/javascript">
window.addEventListener('load',function() {
document.addEventListener('deviceready', function(e) {
var config;
config = {
controlsDark: true,
listsDark: false
};
// Handle styling of the screen before it is displayed
config.onscreenready = function(element, id) {
};
// Handle styling of the screen after it is displayed
config.ondomready = function(element, id, params) {
if (id == 'start') {
init();
loadInvokelistener();
}
};
bb.init(config);
bb.pushScreen('start.html', 'start');
}, false);
}, false);
</script>
in the app.js:
function loadInvokelistener(){
document.addEventListener('invoked',
function onInvoked(info){
//do stuff
}
);
}
I'm wondering if one of two things might be happening: 1) bbUI isn't being initialized during the invoked event 2) bbUI could be getting initialized a second time in the invoked event
i only see this error if i hit F5 in console to "reload" the app.... seems to be coming very early
and its coming even if the invoke event is not fired!
hi,
if i set an invoked listener (ondomready) like :
document.addEventListener('invoked',onInvoked);
i get this error on console:
"TypeError: Type error - bbui.js:883"
webworks 2.0, bbui 0.9.6.957, simulator 10.2.1.1925 + z10
... but the listener is working!