i using gmail api on android , have problem file attachment.
i followed example below: https://developers.google.com/gmail/api/guides/sending#creating_messages_with_attachments
and problem arisen here:
string encodedemail = base64.encodebase64urlsafestring(bytes.tobytearray());
i want attach video file 8mb, line shows 'out of memory' error.
it okay when send image file attachment. (typically below 1mb).
how can deal it?
i don't know android, may way off base, code shows:
mimebodypart = new mimebodypart(); datasource source = new filedatasource(filedir + filename); mimebodypart.setdatahandler(new datahandler(source)); mimebodypart.setfilename(filename); string contenttype = files.probecontenttype(filesystems.getdefault() .getpath(filedir, filename));
you encoding base64
directly, explodes large string. filedatasource
works around that.