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
New Contributor
gootech
Posts: 2
Registered: ‎08-26-2013
My Carrier: none

inviteToDownload() dialog crashes every other time

Hello. We are building a WebWorks application for the BB, with BBM integration. We have set a click handler to invoke the inviteToDownload() dialog:

 

shareButton.addEventListener('click', function() {
    blackberry.bbm.platform.users.inviteToDownload();
}, false);

 

When the button is clicked, one of two things happens: either it opens correctly, or it opens and it closes immediately. These happen alternatingly. Any idea why this might be happening?

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,453
Registered: ‎04-12-2010
My Carrier: Bell

Re: inviteToDownload() dialog crashes every other time

Hi gootech,

 

The code there looks just fine and, once invoked, the OS takes over; there isn't much you can do after that point. It could potentially be an OS issue on the version you are testing. Personally I haven't seen this before myself.

 

Can you confirm the full OS version you are testing on and whether it is a physical device or simulator?

 

The main part we can affect is the BBM registration to ensure everything is in place to facilitate an Invite to Download. The main things we want to ensure are:

1) The webworksready event has fired. More specifically, the load or DOMContentLoaded event has fired on the window, and following this we add / wait for the webworksready event on the document.

2) Following webworksready, we have called and successfully registered with the BBM platform using blackberry.bbm.platform.register.

3) We only call Invite To Download after we are successfully registered.

 

If we're not waiting for this sequence of events, there very well could be a race condition happening between registration and the invite to download.

 

Generally I like to use a flag that gets set upon successful registration, and check against that whenever I invoke any BBM functionality. Often-times I will gray out / disable any such buttons until that registration event has occurred.

 

Let me know if you have any questions.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
New Contributor
gootech
Posts: 2
Registered: ‎08-26-2013
My Carrier: none

Re: inviteToDownload() dialog crashes every other time

Thank you very much for the reply, oros! We are already doing all the above things, in the correct sequence. We'll look into it and post again if the problem remains.
Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,453
Registered: ‎04-12-2010
My Carrier: Bell

Re: inviteToDownload() dialog crashes every other time

Sure thing! Feel free to fire me the BAR file as well and I can test on a variety of OS versions to see if it is consistent.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.