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
Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar
Accepted Solution

Issue with screen rotation on bb10

Hi everybody, I'm having problem fixing the screen rotation for my app.

I'm working on ndk for bb10. And in playbook I didn't have troubles with this.

 

I'm using:

<initialWindow>
<aspectRatio>landscape</aspectRatio>
<autoOrients>false</autoOrients>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
</initialWindow>

 

But still loading portrait if the device is in that position.

 

I also tryied adding

    navigator_rotation_lock(true)

to the code, but keeps failing.

 

Thanks in advance

Developer
Posts: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: Issue with screen rotation on bb10

You can set in QML.

 

NavigationPane {
    onCreationCompleted: {
        OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.DisplayLandscape;
    }
}

 

Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Issue with screen rotation on bb10

Thank you, but I can't do that because I'm developing a game in c/c++ without cascades
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Issue with screen rotation on bb10

What do you use for rendering/drawing?

Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Issue with screen rotation on bb10

GLES, and it's working fine on playbook. If I put the phone in landscape position previous launching the game its load correctly
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Issue with screen rotation on bb10

First of all - I don't know why it does not work.

But I can suggest you tried caching these Navigator event to see whether your app gets them at start UP:

    case NAVIGATOR_ORIENTATION_CHECK:
    	//Signal navigator that we intend to resize
    	navigator_orientation_check_response(event, true);
    	fprintf(stderr,"navigator_orientation_check\n");
    	fflush(stderr);
    	break;
    case NAVIGATOR_ORIENTATION:
    	{
    	int angle = navigator_event_get_orientation_angle(event);
        rc = screen_set_window_property_iv(screen_win_bg, SCREEN_PROPERTY_ROTATION, &angle);
        if (rc)
            fprintf(stderr, "handle_navigator_event(): screen_set_window_property_iv for screen_win_bg");
        int rect[4] = { 0, 0, 1, 1 };
        screen_post_window(screen_win_bg, screen_buf_bg, 1, rect, 0);

    	navigator_done_orientation(event);
    	break;
    	}

 I am just trying to find out whether initial screen position is implemented differently in BB10 (via mentioned Navigator events at start up).

Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Issue with screen rotation on bb10

I added this but it didn't see in the console.

 

case NAVIGATOR_ORIENTATION_CHECK:
fprintf(stderr,"navigator_orientation_check\n");
fflush(stderr);
break;
case NAVIGATOR_ORIENTATION:
{

fprintf(stderr,"NAVIGATOR_ORIENTATION\n");
fflush(stderr);

break;

}

 

I also found that if I launch the game from the momentics always run ok. 

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

Re: Issue with screen rotation on bb10

>I also found that if I launch the game from the momentics always run ok. 

what do you mean by that?

Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Issue with screen rotation on bb10

If I launch from the IDE it's always run fine.
If I launch from the icon on the phone the issue is back
Contributor
Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: Issue with screen rotation on bb10

I tried also with navigator_set_orientation_mode(), but still loading in portrait