Thread blackBerry Widget model

Anyone know where there is a documentation on the threading model used in the BlackBerry Widgets?

Run this wire Java code that is called from JavaScript? For example if I have

scriptEngine.addExtension("window.someFeature", new SomeFeature());

and then run a method like

window.someFeature.foo()

starting from JavaScript, this thread the corresponding Java code run?

For example from this code I'm sure calling something like

scriptEngine.executeScript("alert('foo')");

Thank you!

The extension will take place in the thread of JavaScript.  It is to be careful in your code if you access something that runs in the UI thread.

If you're not careful, you can get in a deadlock situation.  An example of a deadlock situation, we met with our navigation mode can be found here:

http://supportforums.BlackBerry.com/T5/Web-development/focus-based-navigation-hangs-device/TD-p/4556...

We have created a fix on the way to a handful of situations where you need sometimes to go to the UI thread and do it safely.  If you look at source code for navigation mode found in the patch of BlackBerry 6 we published, you will see how we are misleading treatment to another thread that is not the UI thread to get around any possible blocking scenario.

The source code of this patch can be found here:

http://supportforums.BlackBerry.com/T5/Web-development/supporting-BlackBerry-widget-applications-on-...

Check out the code in the device_templates directory.

An another good rule of thumb is that if your code might work for a period of time, to implement a callback interface asynchronous instead of blocking the thread of JavaScript.

Tags: BlackBerry Developers

Similar Questions

  • Threading in extension of blackberry widget

    Hello, I am new to blackberry widget development. I created an extension that allows me to get a precise gps location, however my application hangs while he does this, how can I implement threading in my extension.

    I searched for days and has been unable to find anything. Any help I appreciated

    What platform are you on?  BB OS 5.0 or 6.0?  There is a difference in threading between the two.

    The Widget JavaScript Extensions are on the thread to dispatch event application on 6.0, but not on 5.0.  In both cases, however, you must configure your GPS receiver on a separate extension thread.  It is done the same thing, as in any other Java environment, using Thread or Runnable classes.

    public class MyExtensionFunction extends ScriptableFunction {    public Object invoke(Object obj, Object[] oargs) throws Exception {        // Run this on a background thread so that JavaScript can continue on        Thread thread = new Thread(new Runnable() {            public void run() {                // set up GPS listener here            }        });        thread.start();    }}
    
  • BlackBerry.System.Model return undefined

    Hello

    I have an application based on sencha touch 2.1 and I add the webworks inside lib.

    When I try to get the device model using blackberry.system.model returning undefined.

    But other api such as blackberry.system.softwareVersion, blackberry.system.name, blackberry.connection.type works fine.

    Thank you & best regards

    Arun

    What operating system you test on? The model property is not supported in BlackBerry 10:

    https://developer.BlackBerry.com/HTML5/APIs/BlackBerry.System.html#.model

    However, we have an API community for this here:

    https://github.com/BlackBerry/WebWorks-community-APIs/tree/master/BB10/deviceInfo

  • Blackberry widget static header/footer positioning

    I worked retail fixed header/footer in my blackberry widget. Here's my progress:

    
    
        
            
            Blackberry Header and Footer
            
            
        
        
            
            
    // content goes here

    It is obviously not the best coding in the world, but it seems to work OK, except that I can't scroll the content when it is large.

    I've searched around, but couldn't find much information about him.

    It would be nice to have a standard header/footer, with the hacks built in work.

    If I could somehow overflow of average content to scroll with touch screens, then it should be good to go, right? Also, to implement other features... etc...

    I have not yet tried jQuery mobile, but some things you may be bumping into one I've seen documented.

    Currently, jQuery mobile only supports the torch and the BlackBerry webkit browser. They intend to make browsers more ancient in the mix that they continue with jQuery mobile (I think that all the way back to the browser of 4.7 on the storm).

    Second, I noticed that some of jQuery contained the names of file a ' - '. You will need to rename these files and make sure that all the links in the library are not violated between all the files for the compiler to BlackBerry widget to consume these resources.

    just the two big things I can think of that you can encounter. I'll post to the top if I have the chance to try the library.

  • trying to jquery mobile (alpha2) working in a Blackberry widget

    Sorry, I'm rather new with widget development.

    I try to get mobile jquery working in a widget on a blackberry 9780.
    If anyone has tried it, please let me know if it is worth.

    My first question was that jquery uses dashes in filenames, which seems
    be banned in Blackberry widgets, so I had to change all the dashes to emphasize.

    Today's question is Packer message: "Invalid widget archive - reserved found directoy.
    No error number. Y at - it a packager error messages published index. Are there rules

    on the directory names? They have to be reported in the xml file?

    bbwp version - 1.5.0.18

    mobile jQuery - 1.0a2

    resolved - Packer Widget was to launch "/ bin" directory. I guess "/ bin" is a reserved directory name.

  • The Service WCF and Blackberry Widget does not. See where I am going wrong?

    I'm creating a widget of BB with Visual Studio 2008 and I created a WCF Service hosted in Windows Azure.

    This is one of the methods in the WCF Service:

     public string ClockIn(string emailAddress)
            {
                try
                {
                    using (var dc = new TEI_DataContext(_MyDc))
                    {
                        SecurityLogin sl = dc.SecurityLogins.SingleOrDefault(s => s.EmailAddress == emailAddress);
                        var tc = new TimeClock { ClockIn = DateTime.Now, UserName = sl.UserName };
                        dc.TimeClocks.InsertOnSubmit(tc);
                        dc.SubmitChanges();
                        return "You're Clocked In!";
                    }
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }
    
            }
    

    I tested it with a Console Application like this, and it works GREAT!

    var client = new TEIServiceReference.Service1Client();
    string result = client.ClockIn("[email protected]");
    Console.WriteLine(result);
    Console.Read();
    

    Here is the address of public WCF Service: http://a1e17152bcf647aaa300ccb5a8a2a2c5.cloudapp.net/Service1.svc

    Here is my HTML code for the widget:

    
    
    
    
    TEI Time Clock
    
    
    
    
    
    

    And here's my JavaScript code:

    var xmlHttp = new XMLHttpRequest();
    
    function ClockIn()
    {
    var url = "http://a1e17152bcf647aaa300ccb5a8a2a2c5.cloudapp.net/Service1.svc/ClockIn/[email protected]";
    xmlHttp.open('GET', url, true);
    xmlHttp.onreadystatechange = callbackFunctionClockIn;
    xmlHttp.send(null);
    }
    
    function callbackFunctionClockIn()
    {
    
    if (xmlHttp.readyState == 4)
    {
    var result = xmlHttp.responseText;
    //result = result.getElementsByTagName("string")0].childNodes[0].nodeValue;
    alert(result);
    }
    }
    

    When I run the widget, an EMPTY popup appears and it NOT me clock. Can you see what I'm missing?

    Thanks a lot for your help and your time!

    Brenda

    The? did not help either. Bad luck!

    I just hired a Blackberry app developer, and he thought of it in Java.

    Thanks for trying to help out well!

  • AJAX request works just with a Wi - fi Blackberry Widget

    I'm doing an Ajax request to're RESTful WebService. When I run the Simulator everything works fine, but when I install the widget for blackberry on my device (9800) applications works when I'm using the Wifi connection...

    It's my config.xml file:

    
    http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="0.2.0.0">
      bbbb
      bbbb
      
      
      
      
      
      
      
      
      
      
        
        
        
        
        
        
        
        
        
      
      
      
      
        TCP_WIFI
        MDS
        BIS-B
        TCP_CELLULAR
        WAP2
        WAP
      
      
      
    
    

    Why this is happening?

    Finally! I found it! I have no why, but it works only on .com, .net o .org domains

    I made the request to a .mobi domain.

  • BlackBerry locked model Smartphones will not be unlocked

    Hi all

    Just recently got a new BB storm and get accustomed, I downloaded the above diagram lock as it had good reviews, so I put the model and now it used to unlock.iM IN A RIGHT MESS that I know cannot use it. Is them what I can do? Hope you can help me

    Paul

    I would recommend contacting the proponent and by following the recommended route to support:

    [email protected]

    http://appworld.BlackBerry.com/WebStore/content/1524

  • Is there a Firefox application available for the classic Blackberry 2015 model?

    I have a classic Blackberry. I was wondering if it is possible to obtain a browser Firefox on a classic Blackberry app to use rather than the stock browser?

    TThanks

    The BackBerry operating system is like 10 BlackBerry and the BlackBerry Tablet OS older for PlayBook is based on QNX. Once long ago, you could build Firefox for QNX, but support for QNX has long been removed from the Mozilla source tree.

    There has been no development of Mozilla mobile browser for any material or BlackBerry OS.

    Mozilla Firefox has for mobile desktop Windows, Mac OSX, Linux and Firefox for Android 2.3 +. There is also the "BONE of Firefox" used on say that some budget phones and some new Tv's Panasonic. They have also recently started with a shell for iOS 8.2 Firefox browser +.

  • BlackBerry widget background-attachment: fixed;?

    Does anyone know how to create a fixed background image? Finally, I would like to have fixed a fixed background image with a header div, but I work on one thing at a time...

    See you soon,.

    G

    By fixed... Do you mean using a div in a fixed position via CSS?

    If so, do not make the fixed fixed positioned divs on BlackBerry.  They will scroll/jump with the content.  It's just a limitation of the implementation.

    I posted an example of a header/footer show/hide to parchment here:

    http://supportforums.BlackBerry.com/T5/Web-development/fixed-position-toolbars-example/TD-p/643949

  • Of Blackberry widgets can run on the Pearl 8100?

    Hello

    I'm creating an application or widget for a customer who has already purchased the Pearl 8100 for its employees. The widget or app must fill out a form, store data locally, and if there is network coverage, send the data online. Given that I can't edit or update the device, is the approach of widget completely out the window? From what I gathered, the widgets are for OS5 and this operating system is not available for the 8100 pearl.

    Thank you

    -Zach

    Hello Zach,

    Unfortunately, you will not be able to run widgets on a 8100. They are not able to be upgraded to OS 5.0

  • BrowserFieldDemo does not work on BlackBerry (8900 model)

    The BrowserFieldDemo application does not work on the device, model 8900 curve and the same app works perfectly on Simulator 8900.

    I compiled the application with component and registered code signing package JDE 4.6.1. I gave all the permissions the application on the device (all permissions are set to "Allow").

    The web page, which I am trying to access the app has a label message and a text box in the HTML code.

    I am not able to understand if it works perfectly on the 8900 Simulator, why even does not work on the device.

    can someone help me on this please?

    Have you tried to add '; inteface wifi = "or"; deviceside = true' to the URL depending on the type of connection?

  • Article "what BlackBerry smartphone models and their corresponding GPS...". »

    Hi guys.

    This is article about GPS skills and function of carrier list.

    I use this picture on my request.

    I have a simple question about this article.

    So, you can see Bell5 and Bell service provider field.

    Actually I don't know what is the Bell provider.

    Like Cincinnati Bell and Bell Mobility.

    You know Bell5 and Bell?

    What is the real name of Bell5 and Bell?

    Thank you guys.

    Bell refers to the Canadian company called Bell (Bell Canada).

  • Smartphones Blackberry blackBerry 7290 model

    I have a 7290 I can receive text messages but cannot send text messages, please help

    I don't understand I'm new on this please be patient with this * beep * thanks for your help

  • Webworks Blackberry application does not not remote page on Simulator

    My application Blackberry Webworks a problem opening a remote page when testing it in a Blackberry Simulator (I tried Verizon 9630, 9700-ATT, 9860-Asia). Whenever I try to open a remote page in my application webworks, the application crashes, and after a while, I get a white screen with the error error 104 Eception App: InterruptedIOException and when I click on continue a dialog message box comes up with the message Local connection timed out after ~ 120000. If I open this URL in the browser of the Simulator, it opens right away. What I don't know, this is why it does not open in the webworks app.

    Now the funny part is, if I load the same webworks app in my blackberry device, it works perfectly. It opens the remote page immediately. I don't know why its not working in a simulator.

    I have the config.xml file properly configured with the remote url defined in the element of access:

    http://sample-remote-server.com/" subdomains="true" />
    

    I will be very happy if someone can spare their time to help me.

    Thanks in advance.

    bigjavajoe wrote:

    Do not know if I did... I just open the Simulator and load my webworks app.

    How to make the MDS?

    If you are using eclipse, see this thread:

    http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/cannot-connect-to-Internet/TD-p/...

    But if you don't use eclipse or just command-line bbwp, try to find the mds file in your path of Blackberry Webworks (usually in \Program Files\Research in Motion\BlackBerry Widget Packager\mds),

    After searching for the folder, find the run.bat file, then run it.

Maybe you are looking for