Monthly Archives: July 2016

Develop mobile Flashight app

In this post I’ll discuss how to develop a flashlight app using AppyBuilder (FREE or Silver plan).

The final app will look like image below, allow user to tap on ON or OFF image buttons to turn camera flash ON or OFF and to also change the displayed image to ON or OFF flashlight images.



Designing the layout:

To start, goto AppyBuilder (free or silver) and create a new project called flashlight.

We’ll use HorizontalArrangement to contain the ON, OFF image Buttons and to also include a text (Label) that will display in between the two image buttons.


Table below shows the components and their associated properties that were used to design the above layout. Note: For images, refer to the .zip file at the end of this post.


Next, from User Interface palette, drag and drop an Image component into viewer and set its width and height to Fill parent and set its Picture to flashon.png.

From Media palette, drag and drop a Camera non-visible component into viewer. Also, from User Interface, drag and drop a Notifier component into viewer. Camera will be used for turning flash on or off and Notifider will be used to display alert messages. By now, your viewer should look like figure below:


Coding the blocks:

We are done with designing the layout and will now switch to Blocks Editor to code the app functionality.

Once in Blocks Editor, select the Camera component and you’ll see its associated blocks as shown in figure below. You’ll notice that Camera has a HasFlash block that once executed, returns true if device has flash or false if it doesn’t. Camera also has a FlashOn block that takes a logic true or false block  to turn flash on or off.


We now logic for turning flash on when btnFlashOn button is Clicked. While in Blocks Editor, select the btnFlashOn component and then select its Click event handler which will be triggered when the ON button is clicked. From built-in Control blocks, select IF block. We’ll use this block and plug in  Camera.HasFlash to determine if our device has flash or not. If Camera HasFlash, then we’ll use Camera.FlashOn and use logic true to turn flash on, else we’ll use our Notifier component to pop-up a message letting user know that device doesn’t have a flash light. If device has flash, we’ll also change the Picture for Image to flashon.png to show that flash is on.

The blocks for coding this is shown in figure below:


Lastly, we’ll code the blocks for turning flash off. Figure below shows that in the Clicked event-handler of btnFlashOff, we use Camera.FlashOn block to turn flash off and switch the Image picture to flashoff.png.


Download .apk:

You can download .apk from HERE or scan QR code below to install onto your device:


Download source code and images:

The source .aia and images can be downloaded from HERE.


Leave a comment

Posted by on July 3, 2016 in Uncategorized

%d bloggers like this: