03-14-2013 10:37 AM - edited 03-14-2013 10:38 AM
I have an application (main application) and I have a requirement that this application should launch a new application when it is minimized (or killed).
I could capture the event NAVIGATOR_WINDOW_INACTIVE whenever my main application is minimized, however if I try to invoke my second application, it doesn't get invoked and the main application is minimized. I however get an error (INVOKE_BAD_REQUEST_ERROR) in NAVIGATOR_INVOKE_TARGET_RESULT event.
The invoke works fine from the other places in main application
I am calling invoke as below:
navigator_invoke_invocation_t *invoke = NULL;
// set action
// set handler ID
// invoke the target
// clean up resources
Any help would be greatly appreciated.
Solved! Go to Solution.
03-14-2013 10:53 AM - edited 03-14-2013 10:59 AM
Have you considered this may be by design to stop apps keeping themselves active?
Invocation is really there for user interaction between apps, doing what you are trying to do opens up the possibility of apps that spam or annoy.
I'm not saying this is the reason but it is a possibility.
If your app is somehow still alive by the time the communication layer is set up how likely is it that when the data request stage happens it is closed and therefore the error is returned?
03-14-2013 11:00 AM
Well, as per documentation it should work. If not, it should be mentioned somewhere in documentation or someone from Blackberry should clarify.
However, I agree to your point that it may be intentional.
03-14-2013 11:04 AM
I agree there are lots of these kind of corner cases that are missing from the documentation.
I take it you've tried things like delaying shutdown until the invoke acknowledge request comes in?
03-14-2013 11:07 AM
Yeah, I tried delaying and acknowledge also comes in in the form of INVOKE_BAD_REQUEST_ERROR.
The other possible cause I guess would be that I might be trying to launch using incorrect invoke parameters (which is unlikely as it works fine if I try to invoke it at some other event)
03-14-2013 11:55 AM
It's looking more and more like intended behaviour then.
You'll have to wait until the background services get added to BB10 or find another way of doing what you are attempting.
If you let us know what purpose you have in doing this someone may be able to offer an alternative.
03-14-2013 11:58 AM
Any idea when background services are being implemented in BB10?
I need to create a 'Kiosk' like applicatin which has to be on the top always. Since there is no such API, this was work around to create two similar applications and start the other one when first goes in background.
03-14-2013 12:13 PM - edited 03-14-2013 12:15 PM