Camera Plugin

Stable Version 6.1.0 (O11)
Also available for 10
Published on 16 Apr by 
Created on 30 June 2016

Camera plugin allows you to have access to the camera in the application.

Note: This plugin has as a dependence on the Common Plugin.

Before any other action, you need to check if the camera plugin is available, and to accomplish that, you should use the action “CheckCameraPlugin”. After that, and in the case of “success”. You can use the other activities available in this plugin - “TakePicture” that allows the user to obtain the picture that was taken if it was successful to take the picture.

How to use this plugin (Example):

Step 1) Open Service Studio, click on “Install Application”. You will be redirected to the forge page. You write the name of the component, in this case, Camera Plugin. 

Step 2) After the download and installation are done, let’s create your application. Click on “New Application” and select “Mobile App”.

Step 3) After creating the application, click on “Manage Dependencies” and import the two actions given by Camera Plugin.

Step 4) Add a screen. You can do this by right-clicking in the Main Flow and select the option “Add Screen”. After this select the Empty Screen and give a name to the screen like “Sample Screen”. 

Step 5) Add a button to the screen, and associate a client action to this button. Also, add a local variable named “Picture Taken” of the type Binary Data.

Step 6) Switch the Logic Tab, and right-click in Client Actions Folder, to add a Client Action. In this action is where we are going to create a logic to take a picture using camera plugin. Add an Output Parameter named “PictureTaken” .

Step 7) After creating the action, drag a Client Action and select the “CheckCameraPlugin”.  First,  put this action in order to validate if the equipment has access to the camera plugin.

Step 8) Drag and drop "an If" to check if the plugin is available. You can use the output parameter “IsAvailable” of the action “CheckCameraPlugin”. 

Step 9) In the right of the if, drag another Client Action and select the TakePicture action. Connect the “True” branch of the if to this action. Above the if drag a “Message”, the type of message is error and the Message the ErrorMessage from the action “CheckCameraPlugin”.

Step 10) Next to the action “Take Picture”, drag and drop another if which is going to validate if the action “Take Picture” is successful. To the right of the if drag an “Assign” and put the following assignment. Connect the true branch of the if to the assign. 

Step 11) Below the TakePicture if, put a message with the type error and the message the Error Message from the action TakeError.

Step 12) Your Action should be like the image below.

Step 13) After creating the action, go back to the Interface you created before. Bellow the button add an image. The type of the image, in this case, is Binary Data and the ImageContent, the local variable created before. 

Step 14) Click 1-publish. To test this application you can use OutSystems Now or simply generate the APKfor this application.

Support Options
OutSystems Supported
Customers entitled to Support Services may obtain assistance through Support.
See all 1 dependencies