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

Java Development

Reply
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified

[8900] VideoControl#getSnapshot does not work -> ControlAccessException

Hi folk,

 

I do have the following behavior on a 8900 v4.6.1.175 when calling VideoControl#getSnapshot:

- the view finder is correctly displayed;

- there is a ControlAccessException when taking the snapshot: vc.getSnapshot(imageType), with either imageType=null or imageType = "encoding=jpeg&width=1024&height=768&quality=superfine".

 

Note that this code works fine:

- on my 9700 v5.1;

- on 8900 simulator: as often we cannot trust BlackBerry simulators.

 

Could you help me?

Thanks & Regards :smileyhappy:

 

***

 

I already had a look at the following topics:

- http://supportforums.blackberry.com/t5/Java-Development/Camera-net-rim-device-api-system-controlleda...

- http://supportforums.blackberry.com/t5/Java-Development/Camerademo-does-not-work-on-8900-Curve/m-p/1...

 

Android and iPhone/iPad developer :smileyhappy:... forced to develop for BlackBerry (beginner) :smileysad:
BlackBerry Development Advisor
Posts: 15,023
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

Have the appropriate application control policies been set for your application?  You can view them by going to Options, Applications, selecting your application and choosing Edit Permissions. 

 

Note that by default, application control policies are not enforced by the BlackBerry Smartphone Simulator, which is why you may see a difference.

 

You can use the following steps to enable device security in a BlackBerry Smartphone Simulator, which will enable the security options above.  The steps vary based on whether you are using the BlackBerry Java Plug-in for Eclipse, BlackBerry JDE or stand alone BlackBerry Smartphone Simulator.

 

Stand Alone BlackBerry Smartphone Simulator

 

  1. Run the clean.bat file located in the simulator installation directory.  This resets the simulator to its default state, removing all third party applications, data and user configurable settings.
  2. Edit the ####.bat file where #### represents the BlackBerry Smartphone model number you wish to change.
  3. Add /secure to the command line in the batch file.
  4. Save the batch file.

 

BlackBerry Java Plug-in for Eclipse

 

  1. Click on the Project menu in Eclipse choose BlackBerry and then Clean Simulator....
  2. Choose Select All and click OK.  This resets the simulator to its default state, removing all third party applications, data and user configurable settings.
  3. Open the Run or Debug Configuration options in Eclipse.
  4. Expand BlackBerry Simulator.
  5. Click on a simulator entry.
  6. Select the General tab.
  7. Check off Enable Device Security.
  8. Click the Apply button.

 

BlackBerry JDE

 

  1. Run the clean.bat file located in the simulator directory located in the installation directory.  This resets the simulator to its default state, removing all third party applications, data and user configurable settings.
  2. Click on the Edit menu and choose Preferences....
  3. Click on the Simulator tab.
  4. Click on the General tab.
  5. Check off Enable Device Security.
  6. Click OK.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

[ Edited ]

Thank you very much for you help. It is very helpful to me :smileyhappy:.

Unfortunately, I do not have the same issue with the simulator :\.

 

I managed to have a BB 8900... but the debugger works very badly with this phone :smileysad::

- does not stop on break points;

- variables cannot be displayed.

Moreove I have to use Desktop Software each time to delete my application otherwise the debugger does not attach.

I am developping under Eclipse Java 3.5.2 with the last BlackBerry plug-in.

 

BB 8900 is very very bad and unstable phone :smileymad:. It is a punishment to develop for it :smileymad:.

 

Android and iPhone/iPad developer :smileyhappy:... forced to develop for BlackBerry (beginner) :smileysad:
BlackBerry Development Advisor
Posts: 15,023
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

You shouldn't see the issue in the simulator unless you have enabled device security, as I describe above.

 

Or are you saying you did enable it, but the issue doesn't occur there?

 

Have you configured permissions for the application under Options, Applications, select your application and choose Edit Permissions from the menu?

 

Are there any IT Policies on the BlackBerry Curve 8900 that restrict camera or media use?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

[ Edited ]

Hi MSohm,

 

thank you very much for your help :smileyhappy:.

 

What I meant was that the issue does not occur on simulator, and since debugging on the mobile does not work... I was stucked!

 

 

So I tried to invoke the Camera instead.

This works fine on simulator and 9700, but again not after I take a picture (while listening for file change or after, I cannot know) on 8900, and since debugging on this mobile does not work... I am stucked again and pretty disappointed!

 

Is there any media thing that works well on this mobile???

Hopefully I talked to my client in the afternoon and he may decide not to deliver the application for this non-working phone (I will not charge him for that)... and maybe even not to continue having applications developped for BlackBerry. Anyway, this will be my first and last development for BlackBerry, having lost so much money :smileysad:.

 

Thanks & Regards :smileyhappy:

 

Android and iPhone/iPad developer :smileyhappy:... forced to develop for BlackBerry (beginner) :smileysad:
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

[ Edited ]

1/ I've juste tried my code on a 9700 and it does work... So it is really an issue with 8900.

This phone is really not reliable :smileysad:.

 

2/ By the way, I could not find any API to close the Camera application I invoked. Could you help me?

For the moment I simulate 2 presses on the [Back] key:

   // Invokes the Camera application

   Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());

   [...]

   // Tries to close the camera (not a nice way but I could not find any better)

   // by simulating 2 presses on the [Back] key

   EventInjector.KeyEvent inject =

      new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN,Characters.ESCAPE, 0);

   inject.post();

   inject.post();

... what requires PERMISSION_EVENT_INJECTOR.

This is something very strange: PERMISSION_EVENT_INJECTOR is deprecated, but EventInjector (not deprecated) does not work without having this permission set.

 

3/ And could you tell me which are the args (with their format) I can set in CameraArguments(String args) in order to have a basic camera without zoom, with no setting available, with auto-flash, etc.

As very often, the API does not give any information :smileysad:. (moreover it is wrong pretty often also)

 

Thank you very much again for your help :smileyhappy:.

Regards :smileyhappy:

 

Android and iPhone/iPad developer :smileyhappy:... forced to develop for BlackBerry (beginner) :smileysad:
BlackBerry Development Advisor
Posts: 15,023
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

There are no methods to close a RIM application after it has been invoked.  You can use event injection to inject the backspace key, as you are doing.

The default security settings disable event injection for an application.  ApplicationPermissions.PERMISSION_EVENT_INJECTOR
 was deprecated and replaced with ApplicationPermissions.PERMISSION_INPUT_SIMULATION in BlackBerry device software version 4.6.0.

The CameraArguments allow you to specify the picture camera or video camera.  They do not allow you to change a user's settings.

 

Regarding the ControlledAccessException, have you granted your application the recording permission?  You can check by going to Options, Advanced Options, Applications choosing your application and selecting Edit Permissions from the menu.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

Thank you very much again MSohm :smileyhappy: I will try that on Monday...
Android and iPhone/iPad developer :smileyhappy:... forced to develop for BlackBerry (beginner) :smileysad:
Contributor
Posts: 16
Registered: ‎06-29-2010
My Device: Not Specified

Re: [8900] VideoControl#getSnapshot does not work -> ControlAccessException

Hi MSohm, I've juste tried the permissions you recommend... but it does not change anything :smileysad:. So I am really stuck :smileysad:. Anyway, thank you for your help and the pieces of information you gave me :smileyhappy:. Best regards :smileyhappy:
Android and iPhone/iPad developer :smileyhappy:... forced to develop for BlackBerry (beginner) :smileysad: