Uniform wrapper for iOS com.mfogg.squarecamera and Android pw.custom.androidcamera modules. All icons are provided by Ionicons font; Refer to their documentation to find which icon is available.
tiapp.xml
...
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<!-- Camera Permissions -->
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
</manifest>
</android>
...
index.xml
<Alloy>
<Window id="container">
<Widget id="camera" src="ts.camera" onPictureTaken="onPictureTaken" />
</Window>
</Alloy>
index.tss
"#camera": { // styles for the camera
top: 64,
width: '100%', // default value is the width of the screen
height: '100%' // default value is the same value of the width
},
index.js
function onPictureTaken(e) {
console.log(e.image); // the taken photo
}
Both platforms share the same API:
Function | Parameters | Usage |
---|---|---|
snapPicture | Take a photo | |
switchCamera | Switch the camera front or back |
|
switchFlash | Turn on or off the flashlight |
Event | Usage |
---|---|
pictureTaken | Will fire when a picture is taken |
- 1.0
- Initial version