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
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB

Keep screen awake when app is in background?

Is it possible with ndk to keep screen awake when app is in background ? Air/webworks/android still don't support this, and no idea about ndk

Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800

Re: Keep screen awake when app is in background?

I don't think it's possible right now but by searching in the forum I managed to get that :http://supportforums.blackberry.com/t5/Native-Development/How-to-prevent-screen-to-dim/m-p/1646783/h... hope it helps.  

Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB

Re: Keep screen awake when app is in background?

I saw that. Will try later to see whether it works or not
Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB

Re: Keep screen awake when app is in background?

Seems that is not possible. When app goes in background, it does not affect screen_set_window_property_it() and gdb can not trace anything. 

 

static void handle_navigator_event(bps_event_t *event) {
	
    switch (bps_event_get_code(event)) {
    case NAVIGATOR_WINDOW_FULLSCREEN:
    	//screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode);
    	    	fprintf(stderr,"WINDOWS goes FULSCREEN");
    	    	break;
    case NAVIGATOR_WINDOW_THUMBNAIL:
    	screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode);
    	    	fprintf(stderr,"NAVIGATOR_WINDOW_THUMBNAIL");
    	    	break;
    case NAVIGATOR_WINDOW_INACTIVE:


    	//screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode);
    	fprintf(stderr,"app goes inactive");
    	break;
    case NAVIGATOR_WINDOW_ACTIVE:
    	//screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode);
    	fprintf(stderr,"app goes active");
    	break;
    case NAVIGATOR_SWIPE_DOWN:
        fprintf(stderr,"Swipe down event");
        break;
    case NAVIGATOR_EXIT:
        fprintf(stderr,"Exit event");
        shutdown = true;
        break;
    default:
        break;
    }
    fprintf(stderr,"\n");
}

 

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Keep screen awake when app is in background?

@borceg, that's correct. If no portion of the window is visible (even a pixel is enough) or if the app is not "active" (related to the Application Behaviour control in the system settings) then the keep-awake functionality is not available to it.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!