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

Native Development

Reply
Developer
Posts: 70
Registered: ‎04-20-2012
My Device: BB 9105
My Carrier: Vodafone
Accepted Solution

Invoke doesn't get called when window is going to be inactive

[ Edited ]

Hi,

 

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;
navigator_invoke_invocation_create(&invoke);

// set action
navigator_invoke_invocation_set_action(invoke, "bb.action.OPEN");
// set handler ID
navigator_invoke_invocation_set_target(invoke, "com.example.bb10samples.invocation.openimage1");

navigator_invoke_invocation_set_type(invoke, "image/png");

// invoke the target
navigator_invoke_invocation_send(invoke);

// clean up resources
navigator_invoke_invocation_destroy(invoke);

 

 

Any help would be greatly appreciated.

 

Thanks

Brsengar

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Invoke doesn't get called when window is going to be inactive

[ Edited ]

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?

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 70
Registered: ‎04-20-2012
My Device: BB 9105
My Carrier: Vodafone

Re: Invoke doesn't get called when window is going to be inactive

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.

 

Regards,

Brsengar

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Invoke doesn't get called when window is going to be inactive

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?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 70
Registered: ‎04-20-2012
My Device: BB 9105
My Carrier: Vodafone

Re: Invoke doesn't get called when window is going to be inactive

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)

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Invoke doesn't get called when window is going to be inactive

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.

 

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 70
Registered: ‎04-20-2012
My Device: BB 9105
My Carrier: Vodafone

Re: Invoke doesn't get called when window is going to be inactive

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.

 

Regards,

Brsengar

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Invoke doesn't get called when window is going to be inactive

[ Edited ]

No we've only been told it's coming, it's not on the published roadmap.

 

[edit] Just looked and Headless apps are now on the Roadmap but without a date for inclusion.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 70
Registered: ‎04-20-2012
My Device: BB 9105
My Carrier: Vodafone

Re: Invoke doesn't get called when window is going to be inactive

Thanks for letting me know...

Just curious to know where to check what is and what is not on the roadmap?

 

Thanks

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Invoke doesn't get called when window is going to be inactive

Try allowing "Background processing" in app's permissions.