I have created a hybrid app using Sencha Touch 2.4, Sencha Cmd 5.0 and Cordova 3.5
The view for the app looks like
Ext.define('CameraApp.view.Main', {
extend: 'Ext.Container',
requires: [
'Ext.Button',
'Ext.Img'
],
config: {
items: [
{
xtype: 'button',
handler: function(button, e) {
Ext.device.Camera.capture({
source: 'camera',
destination: 'file',
success: function(url) {
var img = Ext.getCmp("Image");
img.setSrc(url);
}
});
},
text: 'Take photo'
},
{
xtype: 'image',
height: 201,
id: 'Image',
src: 'white.png'
}
]
}
});
And the app.js
looks like
Ext.application({
requires: [
'Ext.device.Camera'
],
views: [
'Main'
],
name: 'CameraApp',
launch: function() {
Ext.create('CameraApp.view.Main', {fullscreen: true});
}
});
When I click the button it comes with the error TypeError: Cannot call method 'getPicture' of undefined
Do anybody know how to fix it?
I have already added the plugin for the camera to the cordova-folder
Of I forgot to add remote: true
in
{
"path": "cordova.js"
}
In app.json