Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
kovy
Posts: 26
Registered: ‎08-25-2011
My Device: Z10
My Carrier: Bell
Accepted Solution

blackberry.bbm.platform.register not working

[ Edited ]

I'm using the simulator with webworks.  I simply call the register method but nothing happen:

 

blackberry.event.addEventListener("onaccesschanged", _bbm.test);
 
options = {
uuid: "aaa90f91-ad95-4ba9-82c4-33f6ad69aaaa"
};

blackberry.bbm.platform.register(options);

 

 

 

The callback method is never called....

 

This code is from:

https://github.com/blackberry/BB10-WebWorks-Community-Samples/tree/master/bbm/complete

 

Also, this is the config file:

 

<rim:permissions>
<rim:permit>bbm_connect</rim:permit>
</rim:permissions>
<feature id="blackberry.app" />
<feature id="blackberry.ui.dialog" />
<feature id="blackberry.bbm.platform" />

 

Please use plain text.
Contributor
Gerii
Posts: 33
Registered: ‎04-30-2012
My Device: PlayBook, DevAlpha
My Carrier: 3AT

Re: blackberry.bbm.platform.register not working

[ Edited ]

Try the code from https://developer.blackberry.com/html5/apis/blackberry.bbm.platform.html . You need to change blackberry.event.addEventListner("onaccesschanged", accessChangedCallback); to blackberry.event.addEventListener("onaccesschanged", accessChangedCallback); as there is a typo in the documentation.
After changing this typo BBM works now in my app, while the code from the sample didn't work in my app (although the sample itself worked when installed)

Please use plain text.
Contributor
kovy
Posts: 26
Registered: ‎08-25-2011
My Device: Z10
My Carrier: Bell

Re: blackberry.bbm.platform.register not working

Nothing happen!  I also tried directly assigning the callback function.

blackberry.bbm.platform.onaccesschanged = function (accessible, status) 
{
    alert("testaccesschanged");
};

 

And calling the register function after...

		var options;

	
		    /* A valid, unique, 36-character UUID is being used. */
			options = {
			    uuid: "33490f91-ad45-4ba9-82c4-33f6ad69fbbc"
			};

		    /* Call the register function with our UUID. */
			alert("going to register");
			blackberry.bbm.platform.register(options);

 Do I need to use the controller to connect to BBM Server?  When I did it, nothing happen too...?

 

Please use plain text.
Contributor
kovy
Posts: 26
Registered: ‎08-25-2011
My Device: Z10
My Carrier: Bell

Re: blackberry.bbm.platform.register not working

The documentation says:

During registration, a dialog opens and guides the user through the registration process.

 

This is my test.  In fact, de dialog never open.

 

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>BBM</title>
	</head>
	<body>
		<script type="text/javascript" src="local:///chrome/webworks.js"></script>
		<script type="text/javascript">
			
		    function accessChangedCallback(accessible, status) {
		        alert("yeh!!!");
		    }

			function onwebworksready() {
			    document.removeEventListener('webworksready', onwebworksready, false);
			    alert("webworksready");
				blackberry.event.addEventListener("onaccesschanged", accessChangedCallback);

				var options = {
				    uuid: "33490f91-ad45-4ba9-82c4-33f6ad69fbbc"
				};

				blackberry.bbm.platform.register(options);
				alert("registering...");
			}

			function onload() {
				window.removeEventListener('load', onload, false);
				document.addEventListener('webworksready', onwebworksready, false);
			}

			window.addEventListener('load', onload, false);
		</script>
	</body>
</html>

 

This is my config file:

<?xml version="1.0" encoding="UTF-8"?>

<!--
 * Copyright (c) 2012 Research In Motion Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 * You may obtain a copy of the License at:
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
-->

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0.895"
        id="bbmsample"
        xml:lang="en">

	<!-- Application details. -->
    <name>BBM Sample</name>
    <author>Research In Motion</author>

	<!-- Application startup page. -->
    <content src="index.html"/>

	<!-- Application icon. -->
	<icon src="appicon.png" />

	<!-- Allow access to external URLs. -->
    <access uri="*" subdomains="true" />

	<!-- Do not cache content. -->
    <rim:cache disableAllCache="true" />

	<!-- Focus-based navigation for BBUI.js. -->
	<rim:navigation mode="focus" />

	<!-- Required permissions. -->
	<rim:permissions>
		<rim:permit>bbm_connect</rim:permit>
	</rim:permissions>

	<!-- Required features for BBUI.js. -->
	<feature id="blackberry.app" />
	<feature id="blackberry.app.event"/>
	<feature id="blackberry.system.event" />
	<feature id="blackberry.ui.dialog" />
	
	<!-- Additional features. -->
	<feature id="blackberry.bbm.platform" />
</widget>

 

Please use plain text.
Trusted Contributor
usr501
Posts: 222
Registered: ‎03-03-2012
My Device: Ripple, LE Z10, Dev Alpha _C, Playbook, Bold 9900
My Carrier: rogers

Re: blackberry.bbm.platform.register not working

[ Edited ]

have you referenced these scripts in your html document?

 

bbui-0.9.4.js

bbm.js

 

Please use plain text.
Contributor
kovy
Posts: 26
Registered: ‎08-25-2011
My Device: Z10
My Carrier: Bell

Re: blackberry.bbm.platform.register not working

These files are optional. I do not use features of these files.
Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: blackberry.bbm.platform.register not working

The BlackBerry 10 Dev Alpha simulator does not currently support BBM.  We are working on adding BBM support to the simulator.  For now you'll need a real device to test on.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.