Home.ts
import { Camera, CameraOptions } from '@ionic-native/camera';
constructor(public navCtrl: NavController,
public camera:Camera
) {}
getImage(){
var control = this;
const options :CameraOptions = {
quality: 70,
destinationType : this.camera.DestinationType.DATA_URL,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
saveToPhotoAlbum: false
}
this.camera.getPicture(options).then(imageData => {
control.shopPhoto = 'data:image/jpeg;base64,' + imageData;
},
err => {
alert('error: ' + err)
});
}
package.json
"cordova": {
"plugins": {
"cordova-plugin-camera": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-telerik-imagepicker": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "your usage message"
},
"cordova-plugin-crop": {}
},
但是我在移动设备上收到错误“错误:cordova_not_available”。 甚至我都安装了cordova。
我安装了Genymotion进行android测试,但在那里无法正常工作。
请帮助我。
答案 0 :(得分:0)
xvlog --sv -f files.f
尝试这个。
别忘了,您将不得不在真实的设备或仿真器/模拟器上对此进行测试。