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

Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Application goes from foreground to background which function is called

Hi All,

   I want to know which function is called when application goes from foreground to background. Please help me.


Thans & Regards


Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Application goes from foreground to background which function is called



ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10

Re: Application goes from foreground to background which function is called

When Apps goes from Foreground to Background, onThumbnailed is called but while the App comes in Foreground from Background, onFullScreened is called.


Press like if this solve your problem and also mark as solved.

Dharmender Singh
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Application goes from foreground to background which function is called

[ Edited ]

if you're comfortable working with c++ you can get a much more reliable version using the bps monitor found in this sample 


and these c++ files will save you from having to create the navigator service.

just throw them into your src folder.

if you get stuck,check the original sample & look for anything that initiates virtualkeyboard service & immitate it with navigatorservice



#include "BPSMonitor.h"
#include "NavigatorService.h"

Q_DECL_EXPORT int main(int argc, char **argv) { const char *uri = "bb.cascades.bps"; qmlRegisterType<bb::cascades::bps::BPSMonitor>(uri, 1, 0, "BPSMonitor"); qmlRegisterInterface<bb::cascades::bps::BlackBerryPlatformService>("BlackBerryPlatformService"); qmlRegisterType<bb::cascades::bps::NavigatorService>(uri, 1, 0, "NavigatorService"); Application app(argc, argv); // Create the Application UI object, this is where the main.qml file // is loaded and the application scene is set. new ApplicationUI(&app); // Enter the application main event loop. return Application::exec(); }



then in qml


attachedObjects: [
        BPSMonitor {
            id: bpsMonitor
            //Receive events when the navigator becomes visible or hides
            navigatorService: NavigatorService {
                id: navigatorService
                onNavWinStateIs: {
                    if (state == 0){
                        console.log("Application FullScreen");
//place window fullscreen code here } else if (state == 1) { console.log("Application Thumbnailed");
//place window thumbnailed code here } else { console.log("Application Hidden");
//place window hidden code here } } onNavigatorHidden: { zoomer.value = 0; loadingImage.translationX = 0; loadingImage.visible = true; hushCam.hushCam.stopViewfinder(); console.log("Navigator Hidden - Closing Viewfinder") } } } ]