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
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified
Accepted Solution

Display Capture API

Hi Guys,

 

Is there Screen capture API in latest Native SDK?

 

Thanks,

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

Re: Display Capture API

There is not.

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!
Developer
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified

Re: Display Capture API

Thank you very much for your reply. Is there any other way to capture the screen programatically?

 

Thanks,

 

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

Re: Display Capture API

There's no way. It's deliberately restricted, for now, for security reasons. Imagine if one app could take images of the screen any time another app is fullscreen...

In future, it's possible they'll provide an API along with a permission that the user would be able to grant. I don't recall them ever having hinted that they'd consider it though.

You might want to explain your "use case" for this here, if it's not something you want to keep to yourself. If enough people have what they consider compelling use cases, it could improve the chances of them adding support in future.

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!
BlackBerry Development Advisor
elena_laskavaia
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: Display Capture API

There is API to capture your own screen (of your own app). It is in "screen" APIs

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

Re: Display Capture API

Heh... good point Elena. I assumed he was asking about a general screen capture function instead of one which would work with your own app!

OP, I believe this is the API to which she refers: https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.screen.lib_ref/topic/rscreen_read_d...

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!
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Display Capture API

screen_read_display() is the API used by the screen capture service, however it requires elevated privileges.

screen_read_window() sounds like the more likely candidate.

 

Cheers,

Sean

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

Re: Display Capture API

Thanks Sean.  I note that this text at the top of the docs for screen_read_window() appears to be incorrect, or at least misleading: "Sends visual data from an updated buffer to its visible window".  See https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.screen.lib_ref/topic/rscreen_read_w...


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!
Developer
aykarthik
Posts: 187
Registered: ‎08-13-2008
My Device: Not Specified

Re: Display Capture API

Hi Guys,

 

Thank you very much for your replies guys.

 

Actually i have to capture the screen from background application. It is possible?

 

Thanks,

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

Re: Display Capture API

As noted earlier, not possible. Only your app's own window. I wouldn't be surprised if when you use that API you don't even get the notification "glow" showing in the screenshot, though the user would see it onscreen. In other words, you're capturing your app's *window*, not the whole *display*.

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!