09-12-2012 04:32 AM
Hi All
My app takes a copy of its screen and saves it in the picture library. On the simulator this works fine. On a real device, a popup appears asking for permission to take the screen shot (which is to be expected). However, when I give permission by clicking Allow all it does is save a white image.
I have googled and found code that checks for permission using ApplicationPermissions.SCREEN_CAPTURE (now PERMISSION_RECORDING) and even this does not work.
Any help with this would be greatly appreciated.
Solved! Go to Solution.
09-12-2012 05:00 AM - edited 09-12-2012 05:01 AM
In my experience, you will get that for the first image. The second one should work fine. Give it a try.
09-12-2012 05:39 AM
I know this is an issue on OS5. I've had the same problem.
It's not much of a workaround but what I did was re-create the image before saving it. It's a bit of a hack and it's not something I would recommend but it got the job done when I needed it.
09-12-2012 01:48 PM
09-12-2012 01:50 PM
09-12-2012 03:20 PM - edited 09-12-2012 03:20 PM
Basically the first time you do it, it will pop up the permissions screen independently of your app, and give your app a white screen as a result of the capture. If the user gives you permission, the next time it will work.
But the best approach is to ask for the permission before you try to capture the screen shot. it is actually really quite easy to check if you have permission and if you don't, then to ask for it. Once you have permission, then capture the screen shot.
The PermissionsAPIDemo sample does not quite match this use case, but if you look at the code supplied, I think you will find it is not that hard to change.
09-13-2012 05:27 AM
Hi Peter
Thanks again for your continued help - it is appreciated.
I tried manually checking the permissions and setting as follows:
ApplicationPermissionsManager manager = ApplicationPermissionsManager.getInstance();
int current = manager.getPermission(ApplicationPermissions.PERMISSION_SCREEN_CAPTURE);
if (current != ApplicationPermissions.VALUE_ALLOW) {
ApplicationPermissions permissions =
new ApplicationPermissions();
permissions.addPermission(ApplicationPermissions.PERMISSION_SCREEN_CAPTURE);
manager.invokePermissionsRequest(permissions);
}
The code above uses the depreciated SCREEN_CAPTURE but I also tried it with its replacement, RECORDING.
When the app started up I saw the dialog asking for permission and I gave it permission, then it displayed another permissions dialog explaining that permission was required to save the screenshot. I accepted this as well and still the same problem - white image (even if saved twice). What on earth am I doing wrong?
09-13-2012 05:41 AM - edited 09-13-2012 05:42 AM
Can you confirm that on subsequent screenshots you do not get a prompt asking you for permissions? By the look ofit you did not change the permissions.
You can also check and set permissions "manually" for your Application. You will find it in Options
On OS 6.0+, it is
09-13-2012 07:15 AM
Hi Peter
Yes I can confirm that on subsequent saves the permissions dialog is not shown.
When I go to manually change the permissions I get the following:
Connections - Custom
Interactions - Custom
User Data - Allow
I can not change Interactions or Connections to Allow - it goes back to Custom
Still the white image.
09-13-2012 07:22 AM
From the Permissions screen, select the "Interactions" drop down, press the BB menu key and select "Expand". You will see a list of the individual permissions, which will include Recording. What option do you have set for this? What options do you have available in the drop down?