I read my photos from the device, which I then display on the screen and send as an attachment in the email. The problem is when I add an attachment it throws me out of android.
Attached to me. show me shows thanks to base64 but it doesn't attach itself as an attachment and completely throws me out of android.
My code is
captureImage= () =>{
const options: CameraOptions = {
quality: 70,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.PictureSourceType.CAMERA,
}
this.camera.getPicture(options).then (imageData =>{
this.base64Image = 'data:image/jpeg;base64,' + imageData;
}, err => {
console.log ('Image error: ', err)
});
}
sendEmail(){
let email = {
to: 'mnemeth83@gmail.com',
cc:'office@webshopassist.sk',
attachments: [
this.base64Image
],
subject: 'Moja fotka',
body:'Poprosím pozrite sa nato!<br><br>',
isHtml: true
};
this.emailComposer.open(email);
}
}
In Android manifest have i this
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="*" />
</intent>
</queries>
Whats the problem? Please help my.Thanks
I had a similar problem with email composer, due to newer Android versions.
Try this:
Install 6.1.1 gradle version and in Android Studio > Gradle Settings point the Gradle to installation folder.
Add distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip to gradle-wrapper.properties.
Keep your added query inside of AndroidManifest.xml
Finally set targetSdkVersion = 30 in variables.gradle.