File created using MODE_WORLD_READABLE not getting sent as attachment by email
- by Dheeraj
I created the SQLite DB using the following code:
context.openOrCreateDatabase(dbName, Context.MODE_WORLD_READABLE, null);
And tried to send it as attachment by email using the following code:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND)
.setType("message/rfc822")
.putExtra(android.content.Intent.EXTRA_STREAM,
Uri.fromFile(getDatabasePath(dbName)));
startActivity(Intent.createChooser(emailIntent, null));
This opens the GMail compose activity with the attachment icon. But the recipient did not receive the attachment.
This has been asked before. But it looks like there is no solution other than to copy the db file to SD card.
My question then is: What is the use of the MODE_WORLD_READABLE flag if another app like GMail is unable to read the file?