09-09-2013 09:31 AM - edited 09-09-2013 09:32 AM
My application has 2 entry points - one is the default which raises the UI of the application and the other one is a background engine which receives the argument "engine", and is marked as Auto-run on startup (and "Do not display on home screen").
When installing the application OTA the background engine starts working automatically and since no permissions are granted yet, it triggers the system's "Application permissions" dialog asking the user "Would you like to grant XXX Trusted application status?" (lets call it Trusted dialog).
After pressing "Yes" I get the "The application was successfully installed" dialog allowing "Run" or "Ok" buttons, which allow me to run the UI entry point (lets call this one Run dialog).
Sometimes I don't get the Trusted dialog, just the Run dialog, but when that happens my UI part is waiting for the engine entry point to start but it never responds.
Querying the ApplicationManager I can see that the engine part is running, although, it doesn't respond to either global events or runtime storage communication.
My guess is that the Trusted dialog did open, but it is now somehow in the background, possibly pushed back by the Run dialog, and it is stuck till the user presses either "Yes" or "No". I also tried a code that if found tries to push the engine to foreground but it didn't work.
At this point my only solution is to reboot the device.
This behavior was observed on Bold 9900 7.1 and 7.0 but I believe it can happen on other devices as well. There is also no specific scenario that reproduces it, it can happen randomly.
Did anyone come across this problem?
Does anyone have any idea how can I resolve this?
Solved! Go to Solution.
09-09-2013 09:48 AM
09-09-2013 11:16 AM
I got sick of trying to debug this kind of issue, now my background processing stops immediately if the app has not been through Setup, and the Ui will always take the user through Setup including checking for permissions.
This means that you can ask the user questions during Setup that influence the way the background processing works.
Seems to work for me. YMMV.
09-09-2013 11:25 AM
My engine entry point does have a inStartup() loop, but it only helps after device boot.
My problem happens after OTA installation where the device is already up and running.
As for an Application instance, both of my entry points instanciate a UIApplication.
But according to logs i have, the engine part doesn't even get it's main() to be called. The freeze happens before any of my code has a chance of being run.
09-09-2013 11:57 AM
Remember that your background processing will be invoked immediately when your app is installed OTA. instartUp() will be false, so the processing will continue. I am guessing that this will then try to run the permissions dialog.
You say the background processing extends a UiApplication - so how do you stop this displaying a UI? Can the user task switch to this UI?
Remember also your application has only one main routine, there is not a separate main for each of your UiApplications.
09-10-2013 10:59 AM
09-10-2013 11:17 AM
09-10-2013 11:27 AM
"For the background process i tried to extend both UiApplication and Application, but i get the same result. It doesn't appear in the task switch menu because i set the acceptsForeground() to return false, and it doesn't show any screen."
As a test, don't set this to false for your background process.
09-10-2013 11:31 AM
09-10-2013 11:53 AM