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
Highlighted
New Developer
Posts: 32
Registered: ‎05-05-2014
My Device: 9780
My Carrier: Idea
Accepted Solution

Bring app to foreground from alternate entry point which is running in background

in my case i have two entry point one is main which is used ti open ui and another one which run in background to receive push .I am calling 

 Application.getApplication().requestForeground();

to bring the app to foreground but it creating new instance of application and opens the app i dont want this i want main app to be in foreground any help plz.....

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Bring app to foreground from alternate entry point which is running in background

send a global event if the UI is running. If not, launch it using applicationmanager.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 32
Registered: ‎05-05-2014
My Device: 9780
My Carrier: Idea

Re: Bring app to foreground from alternate entry point which is running in background

sorry but i am not very known to globalevent where should i implement it in main method or the other ui class

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Bring app to foreground from alternate entry point which is running in background

you can send it whereever you want, using applicationmanager.
in your UI you need a global event listener, register that with the application (addGlobalEventListener)
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 32
Registered: ‎05-05-2014
My Device: 9780
My Carrier: Idea

Re: Bring app to foreground from alternate entry point which is running in background

i tried both globalevent and applicationmanager but it creating two instance of application...

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Bring app to foreground from alternate entry point which is running in background

somehow i am hard pressed to believe that.
a global event needs a receiver, if there is none it just vanishes.

are you able to receive it in your (running) UI application? do some sysout or debug it to confirm.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 49
Registered: ‎12-29-2011
My Device: 9800
My Carrier: vodafone

Re: Bring app to foreground from alternate entry point which is running in background

[ Edited ]
New Developer
Posts: 32
Registered: ‎05-05-2014
My Device: 9780
My Carrier: Idea

Re: Bring app to foreground from alternate entry point which is running in background

@vishakhaYadav10 thanks for your reply it helped and now i solved the problem by link ypu provicded thnks once again :-)