Reputation: 273
I'm trying to share a file using the something like intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
the file is located in the path data/data/my.package.name/folder/fileName
and whenever I try to send the file using the Gmail app I get an error.
I think this is due to the read permissions of the file, and my question is how can give the intent access to the file, without having to copy the file to another location.
Thanks
Upvotes: 1
Views: 1741
Reputation: 26984
The standard mechanism to share content is via the ContentProvider. http://developer.android.com/training/enterprise/app-compatibility.html#sharing_files
Upvotes: 1
Reputation: 48592
Try this it might help you.
You are trying to send the file as an email attachment using intents
.
The reason why the file is empty is that the email app does not have access to the file in data/data/my.package.name/folder/fileName
, due to Androids security model (the data/data/my.package.name/folder/fileName
directory is private to your app).
To attach file on email in android you have to save the files first in external memory.
Upvotes: 3