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

Java Development

Reply
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: App freeze after install with the Trust permissions dialog in the background

I don't understand this:

 

"The background process is indeed invoked immediately, but as far as i can tell, its main()...."

 

There should only be one main().  This main should invoke either your background task or your foreground task depending on the args. 

 

Can you describe what you mean by "its main"?

New Contributor
thedawn
Posts: 8
Registered: ‎09-09-2013
My Device: 9900

Re: App freeze after install with the Trust permissions dialog in the background

Sorry for not being clear enough - there is indeed only one main, and depending on the args it starts the UI or the engine processes.
After OTA install i usually get the Trust dialog automatically indicating that the engine (auto start) is triggered and the Run dialog asking me if i want to run the main entry point of the app.

The problem happens when for some reason, sometimes the Run dialog appears before the Trust dialog, and when that happens the engine process is stuck in the background. I can see its ApplicationDescriptor, but my logs and its inability to respond indicate that its main (same main as of the UI) was not yet run.
When this happens the only way to run the application is to reboot the device.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: App freeze after install with the Trust permissions dialog in the background

I have tried to create a little test for this and think I see the same - on OTA install, the main method was not invoked to start the background process.

 

I was testing on OS 7.  What versions have you been testing on?

New Contributor
thedawn
Posts: 8
Registered: ‎09-09-2013
My Device: 9900

Re: App freeze after install with the Trust permissions dialog in the background

Yes, 7.0 and 7.1 (on a 9900 device).
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: App freeze after install with the Trust permissions dialog in the background

Sorry I don't have a lot of time to test this.  I really should run my test app in a few more devices and see if I can establish some consistency, but that won't happen quickly.  My impression is OS bug, as it should run the background first.  My only suggestion is to code some workaround, like checking to see if the background app is present and if not launching it. 

New Contributor
thedawn
Posts: 8
Registered: ‎09-09-2013
My Device: 9900

Re: App freeze after install with the Trust permissions dialog in the background

I finally managed to workaround this problem!!!
The solution includes 2 things:
1. Detecting that the background process is stuck
2. Running another instance of it

To detect that the process is stuck i used the global events to send a ping with an object, on which the called process should call notify(). The calling process would then wait(timeout) on the object to be notified. If the timeout expired it means the process is stuck (i used 500ms).
To run another instance i had to support an additional argument that triggers the same background engine. BlackBerry identifies identical process with the full argument list, so in order to trigger the same process you can fool it by passing a different argument.