Touch Develop retirement postponed until June 22, 2019. Sign-in and access to cloud assets to be removed on May 23, 2018.Learn More..


TouchDevelop provides the ability to interact with the device camera. However, some features might not be available on all devices.

snapping a picture

The senses→take camera picture prompts the user to take a picture. This feature generally uses the native camera app available on the device.
var pic := senses → take camera picture
If the user refuses or a camera is not available, pic will be an invalid value. It's always a good idea to check for that.
if pic → is invalid then
oops! no picture!
else ... end if

live camera access

In some devices, it is possible to snap pictures immediately (TouchDevelop will still ask for the user permission's on the first time).
This code might not work on your current device: missing Camera capabilities.
Start by getting the reference to the main camera through senses→camera.
var camera := senses → camera
If no camera is available or the feature is not supported, camera will be invalid.
if camera → is invalid then
oops, no camera available!
else ... end if
  • snap a low-resolution preview
var preview := camera → preview
  • display the live camera feed on the wall
camera → post to wall

front and back

You can access the front camera if available through senses→front camera.
var front camera := senses → front camera