PushRegistry in UiApplication

Is it possible using PushRegistry in a UiApplication? I saw examples of PushRegistry using a moped, but not a UiApplication. When I use it, I get a ClassNotFoundException as it is looking for a moped.

This method requires a moped.  You can use the ApplicationManager.scheduleApplication method to plan the launch of a BlackBerry CLDC application.

If you want the application to continue to run and perform an operation at any given time, you could make use of the TimerTask class.

Tags: BlackBerry Developers

Similar Questions

  • Passing an object of the UiApplication class reference

    Hi all

    I am very new to the development of BB and have struggled for hours on something that I think should be very simple. What I have, this is the main class that extends UiApplication and a second class that implements Runnable. From a method in the UiApplication class, I create an instance of the Runnable class. After that, I call a method to start from this class and pass an object originally from the UiApplication class reference - so that I can call a method, once completed the processing of the Runnable class.

    The problem I have, is that once past the object through a call to method reference, the reference instantly cancels and causes a NullPointer exception when trying to call a method in the original class. The structure is as below, but with all the surrounding code subscribed:

    public class MainApp extends UiApplication {
    
        MainApp _MainApp;
        OtherClass _OtherClass;
    
        public static void main(String[] args) {
        MainApp _MainApp = new MainApp();
        _MainApp.enterEventDispatcher();
        }
    
        private void createOtherClass() {
            _OtherClass = new OtherClass();
            _OtherClass.someMethod(_MainApp);
        }
    
        public void response() {
            // code here
        }
    }
    
    public class OtherClass implements Runnable {
    
        MainApp _MainApp;
    
        public void someMethod(MainApp MainAppRef) {
            _MainApp = MainAppRef;
            // _MainApp object reference is null here
    
            new Thread(this).run();
        }
    
        public void run() {
            // stuff here
            // once done, call a different method
            sendDetailsBack();
        }
    
        public void sendDetailsBack() {
            _MainApp.response(); // causes a NullPointerException
        }
    }
    

    I rewrote this to only show the code at the source of the problem. I don't quite understand why the object reference is not passed correctly - I have tried many other ways to call back to the UiApplication function, including static calls.

    Any help on how I do it is very appreciated!

    Will be

    I suspect that your problem is here:

    MainApp _MainApp = new MainApp();

    I think you meant just

    _MainApp = new MainApp();

  • UiApplication using PopupScreen

    Hi all

    This is my first post on this amazing forum. I read through many large threads with lots of answers to the questions I had in my short time developing applications for the BlackBerry smartphone. Unfortunately, I hit my first stumbling block, which I'm sure will be very easy, but hey, we all start somewhere.

    The question that I'm doing the experience simply creates a PopupScreen in the mainevent thread and wait for user input before continuing. In my days of Swing I just use an observable model and notify the application of change, but I seem to have trouble with this concept here. I tried to use the pushModalScreen and the pushGlobalScreen of the UiApplication class methods, but both give me a runtime... error pushGlobalScreen called by thread of non-event.

    It seems to me missing something probably just in front of me, but I would appreciate help on this. I just use this example using the 9000 Simulator that is packed with the JDE v4.6

    public static void main(String[] args) {
            MyApp app = new MyApp();
            app.enterEventDispatcher();
        }
    
        MyApp() {
            final PromptTest prompt = new PromptTest();
            invokeLater(new Runnable() {
                public void run() {
                    pushGlobalScreen(prompt,1,UiApplication.GLOBAL_MODAL);
                }
            });
            continueProcess();
        }
    
        public void continueProcess() {
        // do something with input from PopupScreen
        }
    }
    

    Thank you.

    Well, I'm a little bit embarrassed. I have solved my problem. Using just pushScreen, like any other approach and all simply migrate code to deal with in my fieldChangeListener. I don't know what I thought earlier. I'm sorry to have lost someone's time on this one.

  • Push the message overall form of a substantive uiapplication

    I have a uiapplication, which has a user interface with the main menu, mainscreens and other things, but it works also on startup, in order to keep listening for updates. I made a point of entry for it, so I can push the GUI when I want to.

    And I want to inform the user, with a simple dialog screen, when theres updates day and asks if he wants to start the application (gui).

    The problem is: I want the dialogue on the home screen, like a simple notice, but I couldn't, because I try pushGlobal the uiapplication on background, and even if I had the Ui.getUiEngine (), it returns the uiengine uiapplication and then it only shows if I enterEventDispatcher(), with a white background.

    I can't extend ask just to show the dialog boxes, because my application's gui.

    I think I may have need to create two applications, an Application that extend, to manage the listener in the background and to be able to pushglobal dialogues on the home screen and an another UiApplication which extend, can be described as the first.

    Is there another approach? Is it possible to dialog boxes of pushGlobal on the home screen of a uiapplication?

    I searched a lot but I have not found someone who wanted to do what I need. In fact I think I'm on the wrong track, so I hope someone will have the answer to my problem.

    So, as I thought, the solution is quite simple.

    I created another class that extends the Application and when I want to start the listener in the background, instead of instantiating my UiApplication I just instantiate this class, which looks like this:

    SerializableAttribute public class BackgroundListener extends Application {}

    Public Sub startBackgroundThread()
    {
    New Thread() {}
    public void run() {}
    While (true) {}
    try {}
    Thread.Sleep (180000);
    } catch (InterruptedException e) {}
    e.printStackTrace ();
    }

    do my logic

    synchronized (getEventLock()) {}

    with this UiEngine, I am able to pushGlobal dialog boxes

    When I want to with the application in the background

    UI UiEngine is Ui.getUiEngine ();.
    Screen = new dialog box (Dialog.D_OK, "You have updates!",
    Dialog.OK, Bitmap
    .getPredefinedBitmap (Bitmap.EXCLAMATION),
    Manager.VERTICAL_SCROLL);
    ui.pushGlobalScreen (screen, 1, UiEngine.GLOBAL_QUEUE);
    }
    }
    }
    }. start();
    }
    }

    And my main method ends like this:

    Public Shared Sub main (String [] args) {}

    {If (args.length > 0 & {args [0] .equals ("gui")})}
    MyUiApp app = new MyUiApp();
    app.showGui ();
    app.enterEventDispatcher ();
    } else {}
    BackgroundListener app = new BackgroundListener();
    app.startBackgroundThread ();
    app.enterEventDispatcher ();
                
    }
    }

    Thanks for listening! Laughing out loud

  • TimerTask calling UiApplication.getEventLock)

    I use a Timer object for several TimerTask objects that are run at various intervals (a few times per second, approximately every 30 seconds, etc, so nothing urgent). These objects TimerTask do very little work but they access various areas (e.g., setting the text of an EditField), and they call UiApplication.getEventLock () prior to do. And it works fine, no problem.

    However, in order to ensure I'm good things, because TimerTask or objects of a Timer object to follow very quickly, calling UiApplication.getEventLock () would be a problem, as it can effectively block thread of the Timer object, which is supposed to "finish quickly." Thank you

    The worst that will happen is that tasks planned for the future will be delayed in their execution. If your tasks are not urgent, then don't worry in this regard. In any case, nothing on the thread of the event is supposed to take long, either, so the wire from the timer should not have to wait a lot to synchronize the lock.

    If this is a concern, you can always use invokeLater rather than synchronize the lock of the event.

  • Occurrence of-> UncaughtException UiApplication

    Hi guys.

    I certify the source code.

    My application has a screen.

    The main point is to add several LabelFields to screen in thread.

    public class MyApplication extends MainScreen {
    
         public MyApplication() {           ..............     }
    
         public void addInfoField(LabelField info) {           this.add(info);     }
    
         private class AddInfoFields extends Thread {
    
               public void run() {
    
                      for(int i = 0; i < 150; i++) {                       ....                       final LabelField info  = new LabelField(".....");                       UiApplication.getUiApplication().invokeLater(new Runnable() {                            public void run() {                                  addInfoField();                            }                       }                  }           }     }}
    

    My question: is there presence rising UncaughtException (such as the queue is full) repeatedly for () ?

    Thank you guys.

    Yes, exactly. You're hungry the UI of event thread. Accordingly, is filled with the message queue and the OS kills your app and a trace of the stack of the forces.

    The form of the device stack trace and look at the object that caused the exception.

  • UiApplication

    How many classes in a project may extend UiApplication? Is there an incompatibility of piles of screen just in case both classes extend UiApplication (assuming it's allowed)?

    As much as you want.  Main however will only be invoked when an Application descriptor is used for an Application that is NOT active, so you have only the option of "EnterEventDispatcher once by UiApplication.»  If you cannot display multiple batteries for a single UiApplication.  Note here that I speak not UiApplication as instantiated and used in the BlackBerry, no classes in your Application code.  .

  • UiApplication - implementation RuntimeStore vs make Singleton object / Instance

    Hi all

    I ran into a lot of trouble with putting the UiApplication instance in the RuntimeStore for later retrieval of etc. other entry points.  I used the code of this resource (http://supportforums.blackberry.com/t5/Java-Development/Make-a-running-UI-application-go-to-the-back...)

    //register the alternate on first run
    RuntimeStore appReg = RuntimeStore.getRuntimeStore();
    synchronized(appReg){
       if (appReg.get(ID) == null) {
           appReg.put(ID, new Application(...));
       }
       Application MyApp = (Application)appReg.waitFor(ID);
       //then you have the app MyApp... return it or whatever
    }
    
    //check to see if the app exists, if it does, bring it to the foreground ...RuntimeStore appReg = RuntimeStore.getRuntimeStore();synchronized(appReg){   if (appReg.get(ID) != null){       Application MyApp = (Application)appReg.waitFor(ID);       MyApp.requestForground();   }}
    

    but UiApplication.getUiApplicationInstance (); Returns IllegalStateException.

    I have posted this before and have read that I might be better to create a Singleton instance of my UiApplication - can I get some advice about how to achieve?  The code I think I should reference is:

    import net.rim.device.api.system.*;
    
    class MySingleton {
       private static MySingleton _instance;
       private static final long GUID = 0xab4dd61c5d004c18L;
    
       // constructor
       MySingleton() {}
    
       public static MySingleton getInstance() {
          if (_instance == null) {
             _instance = (MySingleton)RuntimeStore.getRuntimeStore().get(GUID);
          if (_instance == null) {
    
             MySingleton singleton = new MySingleton();
    
             RuntimeStore.getRuntimeStore().put(GUID, singleton);
             _instance = singleton;
             }
          }
    
          return _instance;
    
       }
    }
    

    Thanks in advance for any help.

    Sorry, I have not looked at your code in detail.  Simon and I wanted to understand what your application was trying to do, rather than how he did.

    What you have described so far, there is no need to put your UiApplication in RuntimeStore.  Or do you need an AlternateEntry.

    So let us try to see if we can get your app working the way you want without steps.  I'm not saying that we will succeed, but trying, we and you will understand better opportunities.

    But note that this is only my opinion and here's how I would implement what you're trying to do, with a single application. I could be missing something.

    Let's start with the listeners.

    Some listeners require a current request - for example SystemListener.  Some are not, for example telephone headsets.  Treatment is kept on a warm reboot - for example, most of the non networking Threads will be suspended and restarted.  Some are not, for example, the ApplicationMenuItems are deleted.

    Assume that at least one of your listeners requires an Application.  In general, I do not use an Application, because I use SystemListener so that I can terminate my treatment in extinction and restart under power.  Which means that you must have an Application that is started automatically.

    Now, you also want to have an icon.  Since an icon is supposed to start a UiApplication, then let us do your started automatically asks a UiApplication.  To do this, you really push a screen, but it can also "requestBackground()", so that it does not actually appear in the autostart.

    The complication here is that some of this treatment actually impossible in the early stages of implementation service, so you need to check for

    ApplicationManager... inStartUp)

    and treat them accordingly.  There is an article that describes what I think.

    So now we have one started automatically UiApplication, who listens to the system start and stop and everything stops at the stop and everything begins to start.

    Now, when you click the icon, you will not actually start your application, you're just before an existing UiApplication.

    I think that so far we have matching your needs with one exception.  What happens if you want to restart your Application?

    We have already described code that stops the processing of your request - we will work this in extinction.  You just need to run that and then do a system.exit().  Now, when your hand is called, the next time that the user clicks on the icon, it will be started just as if it was during the auto-start and will go through the same initialization.  The trick is this time, you don't want to do the requestBackground.

    Here is the key.

    (1) an initialization routine that adds the headphones and starts the other treatment.  This will also push the initial screen.

    (2) an interrupt routine that stops the treatment started in the initialization routine

    (3) main routine creates the UiApplication and adds it as a SystemListener and enterTheDisplatcher.  It checks to see if the treatment is inStartUp.

    (a) if so it horizons application - initialization will be done by the power of SystemListener.

    (b) otherwise, it executes the initialization routine

    (4) SystemListener powerUp routine that performs the initialization routine

    (5) powerOff routine SystemListener which runs the completion routine

    (6) output in your application that runs the completion routine and then call system.exit().

    I think that if you implement these parts, you will have a DBMS which deals with the way you want, with no RuntimeStorage and no AlternateEntry.

  • RecordStore opening to outside the UiApplication

    Hay,

    What is the right way to open the store from outside the UiApplication?

    I can't open the store like that? :

                   try {
                        recordStore = RecordStore.openRecordStore("data98989", true);
                   }catch (RecordStoreException rse) {
                       //exception handling
                   }
    

    I have already given on the RecordStore the UiApplication and want to read the data in the callDisconnected of the AbstractPhoneListener method. Can I do this? How do I do that?

    I've already implemented the AbstractPhoneListener and it works and listening to calls, but it just does not load data from the RecordStore. Can someone help me on this?

    Thanks in advance.

    A RecordStore can be opened only by the MIDlet Suite/Application that created it.  Note that the listeners on a BlackBerry can run in a different process to your application.  This may prevent access to a RecordStore leave in a listener.  As a work around you can use a BlackBerry persistent object.

  • Registration of the MIDlets with the PushRegistry

    Mark & anyone else who can help.

    I am trying to run the example of DynamicPushRegistry found here:

    How - to register a moped with the PushRegistry
    Article number: DB-00390

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800429/How_To _...

    However, when I compile this and try to run it on my BlackBerry 8310, I get the following error:

    "javax.microedition.ConnectionNotFoundException: socket: / /: 5000 does not support push it."

    I tried to change the Protocol of

    "PushRegistry.registerConnection (" socket: / /: 5000... "to"... PushRegistry.registerConnection("sms://:5000). and got the error following different displayed on my BlackBerry:

    "java.lang.ClassNotFoundException: Midlet"text.javax.microedition.midlet.DynamicPushRegistry"is not in the current series.

    Related to this, I'm interested in trying the static PushRegistry example and read the following text:

    How - to create a MIDlet to auto-start using the PushRegistry
    Article number: DB-00385

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800429/How_To _...

    It is said: "After her last updated the JAD file has been added to the project, the COD file must be recompiled for self-registration with the PushRegistry to apply to the MIDlet." Pardon my ignorance, but how is a "recompile" cod file in the JDE without changing the JAD file that comes to be changed? I must be missing something. I am running a 4.2.2.170 BlackBerry version. Help with these questions would be greatly appreciated. Thank you.

    Concerning the socket error, this BlackBerry has been implemented on a BlackBerry Enterprise Server (required for push connections)?

    The ClassNotFoundException is probably caused by specifying an incorrect package name and/or class.  Please check the name you typed in the JAD file.

    Please make sure that the JAD file has been added to the project.  This ensures that it is not changed when the application is built.

  • How can I put a uiapplication and application in a project

    I'm a green hand and not good in English.

    I want that my blackberry project contains a uiapplication and an application which is a background thread, AutoStart, do not display the icon on the home screen.

    How to set my BlackBerry_App_Descriptor.xml?

    Please help me!

    Thank you!

    First and most important of all... Welcome to the BlackBerry forums

    Start reading this article.

    http://goo.GL/vmTJ

  • Confusion on UiApplication and Application in a

    Dear all,

    My concepts on UiApplication and Application are clear, but I'm getting confused by looking at applications such as CallBlocker etc. as

    Here are the requirements of my application

    (1) have a background application that starts automatically at the startup of the phone upward and done something.

    (2) when a particular event occurs then, open the UiApplication where we allow the user to enter something

    If the above tasks are to be done, I am able to do it by two different applications and installing it. But what I want is to have a single packaged application do two things.

    CallBlocker applications are unique packaged applications that have associated UI work and not work on user interface.

    My questions are so

    (1) are two distributed applications together somehow? (this seems a very stupid question if I understand that an application can be Ui or without AC)

    (2) ins Anternate concept being used entry point is these cases?

    Indications in this sense?

    THX

    What are the documents you find missing?

    -l'API is documented so ok, if you know what you are doing you can work with it fine.

    -the developer guides are very detailed, it takes days to read them all. you have videos on top.

    -you get dozens of examples of applications that cover almost everything you want to do in the first half - just avoid copy & paste and try to include some path.

    -knowledge base is large enough. some articles are old, but you will find something for many topics, like the two I linked.

    -the forums contain an overview on problems, just use the search

    (click on the link on resources)

    There are weak points on the development of bb, but I don't think they are related to the documentation.

  • UiApplication.getEventLock () while alread in case of discussion?

    Hi people,

    I have a busy indicator, which is sometimes called from threads of the event and sometimes by background threads.

    Question: Although the extreme example below seems to work, does anyone know of an official RIM statement on the call of the lock of the event from somewhere that happens so that the event thread (as when a user presses a button)?

    Extreme example to get the lock event while in the wire of the event

    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}
    {Synchronized (UiApplication.getEventLock ())}

    SOME WORK

    }

    }
    });

    Thank you

    I think that it is harmless to synchronize the lock of the event when already on the thread of the event. However, you can always check by using Application.isEventDispatchThread () (or Application.isEventThread (), if you have a ref for instance practice).

  • make null pointer exception when accessing a persistent in UIApplication storage

    Hi, I do an apps which depends on a persistent storage, it checks the value, if the screens of its 'regtrue', load screen1 otherwise. I'm getting to chain data.getMessage () null pointer exception

    public class uiApp extends UiApplication {}
      
    Public Shared Sub main (String [] args) {}
    Data StorePersistent = new StorePersistent();
    PAP uiApp = new uiApp();
    theApp.enterEventDispatcher ();
    }
    public uiApp()
    {StorePersistent data = new StorePersistent();
    String gotMsg ="";
    PersistentObject store = PersistentStore.getPersistentObject (0x946aa64a17ee9165L);
    synchronized (store) {}
    data = new StorePersistent();
    data = (StorePersistent) store.getContents ();
    if(Data == null) {}
    data = new StorePersistent();
    }
    Store.Commit ();
    }
    gotMsg = data .getMessage ();
    If (gotMsg.equalsIgnoreCase ("Regtrue"))<------------------------NULL>
        
        
          
    pushScreen (new login()));

    on the other

    pushScreen (new MenuScreen2());
    }
    }

    SRY, it was a stupid mistake, I was retrieving information that was never stored

  • can uiapplication two in one application, or on request and a uiapplication

    examplenot class extends the Application, again a Uiapplication when I heard something happens, I can do?

    I try, but hava a runtimeexception (104), can someone help me?

    I think it would be better that you could clarify what you are trying to reach, instead of indicating the technical path you think you can do.

    In general however, I believe you can use ApplicationManager to launch a new UiApplication from any code, including a "listener" Application, if that's what you try to do.

Maybe you are looking for

  • Windows opens not maximized

    29 Firefox, windows 7, when I click on a link that opens a new window, it will not be in the maximized State. If I maximize the window, then close it, Firefox will not remember and the next time I open a new window, it is not maximized. I use no legs

  • Error running VC ++ 2015

    Our c# solution has some C++ projects which was on v110 platform tool developed on Visual Studio 2012. C++ binaries have been made as well as the Microsoft_VC110_DebugCRT_x64 (and corresponding msm provided for immediate release builds) and Microsoft

  • masking Controls runtime only

    Here's my problem that I'm sure has an easy solution.  I've seen a solution that some time there is for this (I think), but I can't remember where, and my search of the knowledge base and the forum have led no where. I need to make invisible, control

  • Rows and columns in the Listbox

    Hello I downloaded a VI, where I am to study the listbox. In this list box, the elements are different paths. They are files in my system. I would like to have as cells in the listbox control. I would like to have as a single column with different li

  • application of position in JSON (self-development)

    HelloI'm trying to insert a new record into the emp table by issuing a MESSAGE request on my own env. for purposes of development.I m able to hit the GET request. URI is: http://localhost: 8080/ADR/HR/emp /.  But when I try to insert a new record to