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
DrShavargo
Posts: 133
Registered: ‎05-10-2013
My Device: Blackberry Z10
Accepted Solution

Crashing when creating a screen context

Hey everyone,

 

I'm having an ussue with the screen_create_context() function. When I give it the flag SCREEN_APPLICATION_CONTEXT, the program works but returns the incorrect contexts. However, the original code calls for SCREEN_DISPLAY_MANAGER_CONTEXT to be used like this:

 

screen_create_context(&screen_context, SCREEN_DISPLAY_MANAGER_CONTEXT);

 

and returns -1 (0 displays available/crashes the app). The code I took it from can be found here. I'm wondering why I can't access the device displays (root priveledge issue?). Any thoughs?

 

Thanks!

----------------------------------------
Remember to mark the thread as solved at the post that solved your problem, and if you like a post, like it!
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Crashing when creating a screen context

According to API documentation https://developer.blackberry.com/native/reference/bb10/screen_libref/topic/group__screen__contexts_1... only one context type SCREEN_APPLICATION_CONTEXT is valid.

What do you mean by 'returns the incorrect contexts'?

Developer
DrShavargo
Posts: 133
Registered: ‎05-10-2013
My Device: Blackberry Z10

Re: Crashing when creating a screen context

I wonder why SCREEN_DISPLAY_MANAGER_CONTEXT is in the code then...

 

In any case, SCREEN_APPLICATION_CONTEXT returns the software windows, while SCREEN_DISPLAY_MANAGER_CONTEXT returns the hardware display devides, internal and external. I use multiple windows in my code and I need the entire phone phone screen as a whole (as seen by the user), regardless of which windows are present.

 

From the screen_read_display() page: "You need to be working within a privileged context so that you have full access to the display properties of the system. Therefore, a context which was created with the type SCREEN_DISPLAY_MANAGER_CONTEXT must be used."

----------------------------------------
Remember to mark the thread as solved at the post that solved your problem, and if you like a post, like it!
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Crashing when creating a screen context

Keep in mind you are working with BB10 OS not pure QNX.

BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Crashing when creating a screen context

Your app is not the display manager.  this is restricted to privileged software - eg. the Navigator.

screen_read_display() is restricted for a good reason.

There is a security-aware screenshot API coming in the 10.2 release, so wait for that.

screen_read_window() can be used to screenshot your own app though.

 

Cheers,

Sean