Error while working with Blackberry 10

I am trying to use bb: system :: screenshot similar to this

request.setTarget("sys.pim.uib.email.previewer"); // Set the action that the target app should execute request.setAction("bb.action.VIEW"); // Set the MIME type of the data request.setMimeType("message/rfc822"); // Specify the location of the data request.setUri(QUrl("pim:message/rfc822:" + QString::number(accountId) +":" + QString::number(messageId))); InvokeTargetReply *reply = invokeManager.invoke(request); sleep( 2 ); //Screenshot bb::system::Screenshot screenshot; QString filename = screenshot.captureDisplay(); if (filename.isEmpty()) { // Something went wrong bb::system::ScreenshotError::Type error = screenshot.error(); } //Close Email invokeManager.closeChildCard(); 

The problem is that the file name is always empty, and the screenshot.error () file always has an error value. Here is what the debugger says on the line "something went wrong":

screenshot.error () Error: Several errors were reported. \ The MI command failed to execute: -var-create - * screenshot.error () Error message from the back of the debugger: The bb :: system :: screenshot method could not be found: : error \ Unable to create a variable object

Not sure what that means?

EDIT: I moved the definition of the screen variable beyond the if statement and saw this error:

 Name : error Details:bb::system::ScreenshotError::PermissionDenied Default:bb::system::ScreenshotError::PermissionDenied Decimal:2 Hex:0x2 Binary:10 Octal:02 

The problem is that I definitely set the permissions correctly:

  <!-- Request permission to execute native code. Required for native applications. --> <permission system="true">run_native</permission> <permission>access_pimdomain_contacts</permission> <permission>read_device_identifying_information</permission> <permission>access_pimdomain_messages</permission> <permission>bbm_connect</permission> <permission>access_pimdomain_calendars</permission> <permission>use_camera</permission> <permission>use_camera_desktop</permission> <permission>use_gamepad</permission> <permission>access_internet</permission> <permission>access_location_services</permission> <permission>record_audio</permission> <permission>read_personally_identifiable_information</permission> <permission>access_pimdomain_notebooks</permission> <permission>access_notify_settings_control</permission> <permission>access_phone</permission> <permission system="true">_sys_inject_voice</permission> <permission>read_phonecall_details</permission> <permission>access_pimdomain_calllogs</permission> <permission>control_phone</permission> <permission>post_notification</permission> <permission system="true">_sys_use_consumer_push</permission> <permission>run_when_backgrounded</permission> <permission system="true">_sys_run_headless</permission> <permission system="true">_sys_headless_nostop</permission> <permission>access_shared</permission> <permission>access_sms_mms</permission> <permission>access_wifi_public</permission> 

From the documents I need "Permissions: To use this function, the application must have the permissions use_camera_desktop and access_shared."

+6
source share
1 answer

This, apparently, is a mistake in the Blackberry simulator, which goes even further as a 10.2 simulator (a 10.2 simulator when the screenshot library was presented so that you couldn’t go further.) I confirmed this using the Blackberry Developer advisor. (found here, requires login http://supportforums.blackberry.com/t5/Native-Development/Error-Capturing-and-saving-a-screen-shot-in-BB10-c/td-p/3112490 )

0
source

Source: https://habr.com/ru/post/989621/


All Articles