Search code examples
androidgmail

Android Gmail app-Mail Attachment URI issue


I have to open attachment file from gmail app thru my app.

I get link in pattern like content://gmail-ls/messages/mailid%40gmail.com/4/attachments/0.1/BEST/false

My problem is the link is not unique for each file in the mail client.. One or more file has same Uri.

Is there any way to get the file name or email sent date so that I can come over this issue.

Thanks in advance.


Solution

  • I resolved this issue in an indirect way.

    I identified the uniqueness using the file size.

    In-case if you need the code here it is

    InputStream is = getContentResolver().openInputStream(uri);
    FILE_SIZE=is.available();