Frozen push background app

Hello

I implement an application with function Push for OS 5 and above, and I have a problem: when the application does not, when a message arrives, I'm processing (for now I log in only a few details) in a different thread, but when I am clicking on the icon in the phone app either freezes or the application opens not at all - no available hand paper (String []) or.

Here are a few snippets of most important parts:

The base class for UIApplication:

public class JBBasePushApp extends UiApplication implements PushApplication {
    public void onStatusChange(PushApplicationStatus status) {
        // log the status code
    }

    public void onMessage(PushInputStream inputStream, StreamConnection conn) {
        printLog("#onMessage received ... cleaning up");
        new PushMessageHandler(inputStream, conn).start();
    }
}

The implementation class:

public class CPUIApp extends JBBasePushApp {
    public CPUIApp() {
    }

    private void showUi() {
        MainScreen screen = new CPScreen(this);
        pushScreen(screen);
    }

    public static void main(String[] args) {
        CPUIApp app = new CPUIApp();
        if (app.isForeground() || app.isForegroundRequestInProgress()) {
            app.showUi();
        } else {
            app.printLog("Non gui call ...");
        }
        app.enterEventDispatcher();
    }

}

and the PushMessageHandler class:

public class PushMessageHandler extends Thread {
    private static final String MESSAGE_ID_HEADER = "Push-Message-ID";
    private PushInputStream pushInputStream;
    private StreamConnection conn;
    private JSLogger logger;

    public PushMessageHandler(PushInputStream pushInputStream, StreamConnection conn) {
        appContext = ApplicationContext.getSingleInstance();
        logger = appContext.createLogger(getClass());
        this.pushInputStream = pushInputStream;
        this.conn = conn;
    }

    public void run() {
        try {
            HttpServerConnection httpConn = null;
            if (conn instanceof HttpServerConnection) {
                httpConn = (HttpServerConnection) conn;
            } else {
                logger.debug("Conn class: " + conn.getClass().getName());
                return;
            }
            String msgId = httpConn.getHeaderField(MESSAGE_ID_HEADER);
            String msgType = httpConn.getType();
            String encoding = httpConn.getEncoding();
            logger.debug("Msg props: id" + msgId + "; type: " + msgType + "; encoding: " + encoding);
        } catch (IOException e) {
            logger.error("run", e);
        } finally {
            cleanup(pushInputStream, conn);
            logger.debug("Done processing push message");
        }
    }

    protected void cleanup(InputStream is, Connection conn) {
        try {
            is.close();
        } catch (IOException ex) {

        }
        try {
            conn.close();
        } catch (IOException ex) {

        }
    }
}

If I move the call to enterEventDispatcher in the function if() block, main() terminates its execution and it gives no chance to onMessage to run... After that I would end execution to onMessage triggered wire should I consider coming out in some sort of event dispatcher - perhaps the call requestClose()?

Any help would be much appreciated!

Thank you

Isabelle

What I do it is stupind in main()... showUi must always be called. Otherwise the application passes to the dispatcher of events with no active screen and that's why it seems to be stuck.

Tags: BlackBerry Developers

Similar Questions

  • background app refresh all turns on itself.  It happens again and again even after manually more offshore.

    found a weird problem, background app refresh all turns on itself.  even after manually most offshore, he just turn it all back on automatically.  told me that the hottest phone and I have to manually turn off most of them.  but after a while, it happens again.

    BTW, the top bar sometimes disappears as well.

    above 2 questions never happened to me before iOS 10. I'm on iphone5s

    any ideas to get it repaired?

  • Background App Store activity

    Ive never run into problems with the battery life as I case Apple. For the first time today, I dropped 35%, and when I checked in the settings I noticed it says background activity to the title of the App Store. It says use 76 per cent in the last 24 hours. Never even saw the background activity for the App Store as an icon in the use of the battery. Thanks for the help!

    Please read this article for suggestions, including turn off background App update.

    http://www.Apple.com/batteries/maximizing-performance/

  • Firefox is using excessive via "Background App Refresh" battery charge - Although setting being decommissioned.

    I have background App refresh disabled - the scale of the system. However, the Firefox application has managed to get a huge 8.6 hours of substantive activity App Refresh... and eat an important piece of my battery charge in the process. He has used more battery than the Safari app, even if I used just the Firefox App Firefox does NOT respect (and iOS is obviously not properly apply) the updating of the background App setting.

    The Firefox application won a quick deletion of my iPhone. I can give him a second chance in the future, when Apple and Mozilla had the chance to solve this fundamental problem App update.

    Attached are two screenshots. The first is my screen background App update, which shows that I have background App refresh disabled in its entirety and the second, my main screen of the battery, which shows the excessive amount of the battery used by "Background App refresh." Firefox is a flagrant violation in the Protocol of the battery by the Firefox app... and unfortunately, iOS has allowed it to happen.

    I am very pleased to announce that the issue of excessive background use I had experienced with a previous version of Firefox for iOS is part of Firefox version 1.2! I now use the normal battery with little or no background activity. I am very pleased and I intend to continue to use Firefox on iOS regularly.

  • Projector does not? Try to kill background apps

    Spotlight on my iPhone Chess 6 were driving me crazy. About half the time Spotlight returns no results.

    After much trial and error I found that killing a background app, Reeder, 3 (reeder.app) solved the problem. I don't think it's a bug of Reeder, I think it's just that my habits of the user with power supply/Reeder are facing a set of 9.x bugs related to the management of background applications. I had already turned off "Background App Refresh" and Spotlight indexing most of the applications, but I still had to hit kill the background application.

    I wrote my results here: http://tech.kateva.org/2016/01/ios-9-spotlight-fail-fixed-by-killing.html.

    This may get fixed to the 9.3, but in the meantime experiment with updated death of background apps - even if you do not use Reeder. You can find one or two that are particularly problematic.

    jfaughnan wrote:

    Spotlight on my iPhone Chess 6 were driving me crazy. About half the time Spotlight returns no results.

    After much trial and error I found that killing a background app, Reeder, 3 (reeder.app) solved the problem. I don't think it's a bug of Reeder

    This seems quite as if the problem is a bug with Reeder not closing properly in the background. Most of these 'background apps' do not run in the background. They are used most recently.

  • serious security problem with background app refresh (i5 - ios9.2)

    Just discovered that my iphone 5 (ios 9.2) do not listen to update background app at the level settings or individual app phone.

    In my case, "Whatsapp' application is able to bypass this setting (which is defined to restrict the level of the phone or app) but it is still able to download the messages as long as the phone is attached to wifi

    Please note: this is not a bug in whats app - it's a bug with ios 9.2 - that I can confirm with my phone and tested.

    I really hope that apple engineers are aware of this and put a fix as soon as possible.

    Another drawback of this is, it drains dough at least 30-40% more per day!

    Say to Apple.

    http://www.Apple.com/feedback/iPhone.html

  • background app refresh issue

    someone at - it still using an iphone 4 on ios 7.1.2?

    background app refresh significantly affects the performance and the battery life of this device?

    Thank you!

    Hello

    I use iphone s 6 and ipad I have disabled Apps Refresh & now to get more 3/4 hours

    Day of battery life.

    See you soon

    Brian

  • Cannot close the invoked addressbook of background app.

    Hello

    I am unable to close invoked addressbook of background app.

    For help on;

    try {}
    {}
    signalStatus5 = net.rim.device.api.system.RadioInfo
    . getSignalLevel();
    Thread.Sleep (5000);
    } If (signalStatus5 == RadioInfo.LEVEL_NO_COVERAGE);

    int modHandle = CodeModuleManager.getModuleHandle ("setringTone");
    ApplicationDescriptor apDes [] = CodeModuleManager
    .getApplicationDescriptors (modHandle);
    ApplicationDescriptor descriptor = apDes [0];
    ApplicationManager.getApplicationManager () (.runApplication)
    Descriptor);
    Invoke.invokeApplication
    (
    Invoke.APP_TYPE_ADDRESSBOOK,
    new AddressBookArguments
    ());
    } catch (InterruptedException e) {}
    Generative TODO catch block
    e.printStackTrace ();
    } catch (ApplicationManagerException e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }

    You cannot close another application programmatically. If the user closes the addressbook, it should return to your application.

  • Timer crashed in the background app. Why?

    Hello.
    I have no application in the background, it ' s working properly.
    But when I change time in the BlackBerry options, timer broke down.
    I can't find the problem in debugging.
    Help, please.

    I find the solution.
    Don't have to use timer background app.

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-background-application/Ta-p/445226
    Now, I have to press on Bravo for me

  • will be BB 10 support listener in the background / background app?

    Hi, just straight to the point, background app support in BB 10, or if she not in java, do you need the native SDK development?

    Best to ask this question in the native SDK forum, that you will find it on the list here:

    http://supportforums.BlackBerry.com/T5/application-platforms/CT-p/app_plat

    My understanding is that from now on, the native SDK does not support applications running in the background.  It run applications in the background, but it is not yet available for 3 games.  It will of course.

    BTW, in case you missed it, there no support of Java unless you write Android.

  • How a background App can display a UIScreen?

    Hello

    I applied a background of Autostart that implements a listener port bluetooth. After the arrival of all the data, my application must display these data on a screen with the funktion pushScreen (). How can I do both for the display, when BB is in "home screen"(screen after BB reboots)?

    I already have a test application: an application consists of a background thread listening as an application in the foreground graphical user interface (GUI). It works very well.

    I tried to push these two app in a single application. When the background thread listening extends UiApplication not Application, after installation, the BB is dead.

    Any tipps?

    Thank you in advance!

    Monternet

    You can also read this knowledge base article:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

  • Disable the activity of background App on Wifi?

    I'm still new to Android and I'm very stingy on battery usage, and I want to know is possible to disable the background monitoring, querying, data or business applications when I'm on wifi?

    I did some research and it seems that there is only one option for deactivation of the basic data, but only when you use the cell data, and there is no option to do this when using wifi.

    I was also confused on the basic data and notifications. I thought disabling notifications stops background activity, and now I discovered that too, I have to find a way to disable background activity.

    The important thing I want to know, is the apps that are not currently running in (live RAM) can still make this substantive activity? Or they can only do this if they are running, which means that they are in the ram?


  • I want to open the background app after clicking the ok button in the alert illustrated?

    I have an application I have let down in the background.

    After awhile, I show an alert for help:

    synchronized(Application.getEventLock()){
                            UiEngine ui = Ui.getUiEngine();
                            Screen screen = new Dialog(Dialog.D_OK, "Alert!", Dialog.OK
                                                        , Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.VERTICAL_SCROLL);
                            ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
    }
    

    After this code, I add this, but the background application opens instantly, no waiting user click on the ok button:

    UiApplication.getApplication().requestForeground();
    

    How can I take the app in the foreground after the user clicks the ok button?

    Seek to create a DialogClosedListener and make your first query in this plan.

  • Changes in the volume absorbed background app

    Hi all

    I noticed recently (@7.0) that captures the music app (Media Player) volume up/down keys even in the background.

    And a nice modal with volume level appears informing you of the change.

    It's almost as good as the way of Android to manage volume changes.

    (1) how is it possible to capture volume upward / lower the volume of an application while it is not in the foreground?

    (2) is the volume interaction in newer operating system upgraded?

    MediaKeyListener what you are looking for.  It was added in 5.0 and allows an application capture keys media while in the first plan or background.

  • Push BlackBerry app through BES

    Hello

    Push app throuhgh BEs Blackberry... is something necessary next to app...? Register for BEs to push my application to various companies BlackBeries I must... What is the process? I'm newbiew to push App thorugh BES.

    Thank you

    No, it is made on the side server.

Maybe you are looking for

  • The HP Solutions recognizes the photosmart just the old printer

    Hello Does anyone know why the solution Center recognizes that the old printer and not the Photosmart wireless? Thanks for any help, I'm new on this. Maryann

  • "Problem with recording device" - with no Microphone

    In short, despite not having a mic that I usually use Skype calls to be able to listen to friends when you play and do stuff in general. However today all of a sudden when we tried it auto-a ended the call with an error 'problem with the recording de

  • Storage internal MOTO1st Gen with lollipop

    The MotoE 1st Gen provides a 2.2 GB internal storage out of the 4 GB internal memory with pre-installed apps (current version KITKAT 4.4.4). version Then Lollipop will be higher than that internal storage space?

  • Computer fails to boot after installing SP1

    I use Vista without SP1 for quite awhile. I've just updated to SP1 since the message kept popping on my screen. Now the computer will not book. I used the original vista bootable CD and clicked on repair. He began the process of repair, but got stuck

  • Print spooler problem. ERROR (0X000006BE)

    Print spooler problem.  I have a problem with the spooler to stop continuous printing.   I get this ERROR (0x000006be).   I've seen a lot of suggestion already... such as printer drivers are corrupt, need to clear the printer, etc.  I already went to