App Inventor and Java

Take Pictures programmatically using the Activity Starter calling a Java app

With the App Inventor built-in camera component it is currently not possible to take pictures programmatically without user intervention, see also issue 323.

I now created the Java app Take Picture as workaround for issue 323. You can start it from within App Inventor with the Activity Starter to take a picture (without shutter sound) programmatically. The path to the image will be provided in the ActivityStarter.AfterActivity event back to App Inventor.
Thank you Easy Android Tutorials
for the basic source code I'm using for this solution. (Link to Easy Android Tutorials unfortunately broken).

With the help of Take Picture, the App Inventor example app Take Picture Test shoots max. m pictures (configurable in textbox 'max. number') every n seconds (configurable in textbox 'interval in sec') programmatically without user intervention and stores them on SD card in a seperate directory configurable in the Take Picture Java app.
After recording, the taken pictures will be displayed in a kind of "time-lapse video".

You can download the Take Picture Java apk I created and use it together with your App Inventor project.
Note: The App Inventor example app "Take Picture Test" works only, if the Java app Take Picture is installed on your device.

Do you need help with your App Inventor project?

I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.


Take Picture (Java app)

Take Picture Test (App Inventor app)

App Inventor blocks

Take Pictures

Display Recorded Pictures


Tested successfully on HTC Desire running Android 2.2 and Samsung Galaxy Tab 10.1N running Android 3.2.

Questions and Answers

Q1: I wanted to download the source code before donate but the source code is not completed at all: The zip file contains some *.blk and *scm files, no Java files... :( Do you have somewhere else the source code?
A: Take Picture Test (zip file) is an App Inventor Classic project you can upload to App Inventor Classic. Take Picture Test (aia file) is an App Inventor 2 project you can upload to App Inventor 2. Take Picture (apk file) is the Java app which is started from Take Picture Test using the Activity Starter. The Java source of Take Picture is not available online.

Q2: Can I set the location folder from appinventor and send it to the java app in automatic, maybe using the extrakey-extravalue?
A: Currently you can set the folder only in the Take Picture app directly. However I could add that feature for you. If you want this to be added, just transfer 25 USD via Paypal to taifunbaer [at] gmail [dot] com Thank you.


If you find this example helpful and you are using it in one of your projects,
be nice and donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:

Thank you! Taifun

Download Take Picture apk file (Java project)
Download Take Picture Test aia file for App Inventor

Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.

Home | Snippets | Tutorials | Extensions | News | Forums | Links | Search | Contact