10-09-2012 10:40 PM
I am having some problems. I have my .js fileready to go but when I launch the app imgot being questioned if I have registerd or not.
My index.html
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="bbui-0.9.4.css">
<link href="css/xxx" rel="stylesheet">
<link href="css/dt.css" rel="stylesheet">
</head>
<body>
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/bbm.js"></script>
<script src="js/xx.js"></script>
<script type="text/javascript" src="bbui-0.9.4.js"></script>
<script type="text/javascript" src="webworks-1.0.2.9.js"></script>
<script type="text/javascript">
window.addEventListener('load' , function (e){
document.addEventListener('webworksready' , function (e){
bb.init({onscreenready : function(element, id, params) {
if (id == 'timer') {
}
},
ondomready: function(element, id, params) {
if (id == 'timer') {
}
}});
bb.pushScreen('timer.html', 'timer'); registerBBM();
}, false);
}, false);
</script>
</body>
</html>Now here is my .JS file
function registerBBM(){
// Create callback invoked when access changes
blackberry.bbm.platform.onaccesschanged = function(accessible, status) {
if (status == "allowed") {
// Access allowed
} else if (status == "user") {
// Access blocked by user
} else if (status == "rim") {
// Access blocked by RIM
}
// Listen for other status...
};
// Register with the platform
blackberry.bbm.platform.register({
uuid: "3a4cff00-127e-11e2-892e-0800200c9a66" // Randomly generated UUID
});
}What am I doing wrong?
10-10-2012 09:06 AM
Try moving the registerBBM() function to your ondomready like this
ondomready: function(element, id, params) {
if (id == 'timer') {
registerBBM();
}
}});
10-10-2012 10:45 AM
I tried that and im still not getting any thing.
10-10-2012 10:50 AM
I would try using Web Inspector then to see what's happening live on the device. It could be a run time error, or something small that's not obvious.
https://developer.blackberry.com/html5/documentati
10-10-2012 10:56 AM - edited 10-10-2012 11:02 AM
10-10-2012 11:01 AM
I'm wondering if it's even entering your registration function at all? Maybe you could throw an alert in there, and see if it pops up as well.
Here's some sample code from a test app I made.
function setupBBM() {
try {
//Register the app and push the update profile page.
var settings = {
uuid: "9862cc20-c06f-11e1-afa7-0800200c9a66"
};
blackberry.event.addEventListener("onaccesschanged ", changedCallback);
blackberry.bbm.platform.register(settings);
} catch (e) {
alert('Error: ' + e);
bb.pushScreen('bbm.html', 'bbm');
}
}
..and the callback
function changedCallback(allowed, reason) {
if (allowed) {
alert('allowed!');
// do more things here
}
}
10-10-2012 11:03 AM
10-10-2012 08:56 PM
10-10-2012 09:46 PM
Hi there, there should be a sample application for BB10 posted here soon (just waiting on Pull Request approval):
https://github.com/blackberry/BB10-WebWorks-Sample
I'll follow-up once it's available.
greenback, just to confirm though, is it a BBOS sample you're looking for?
Sergio, can we see your config.xml too?
10-10-2012 09:49 PM
yes you can,
<?xml version="1.0" encoding="utf-8"?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.0" id="simple" xml:lang="en"> <name>HI</name> <rim:navigation mode="focus" /> <feature id="blackberry.system.event" /> <feature id="blackberry.app" /> <feature id="blackberry.app.event"/> <feature id="blackberry.ui.dialog"/> <feature id="blackberry.bbm.platform" /> <rim:splash src="images/screen.png" /> <rim:splash src="images/port.png" /> <icon src="images/icon.png"/> <author href="https://sergiosdesigns.com">Sergio Sandoval</author> <!-- <feature id="blackberry.app.orientation"> <param name="mode" value="landscape" /> </feature> --> <content src="index.html"/> </widget>