Android Opening your user files attached to the email application in the application

StackOverflow has several questions based on this. But many of them relate to the file manager. But Android does not come with one.

In my application, I am trying to provide a function in which data can be attached to an email and sent to another user, who can then open the attachment in my application.

All related answers talk about using a path template, e.g.

 <data android:pathPattern=".*\\.ext" />   

But this will not work with e-mail messages and files from the Downloads application, since they hide the file name when sending to the action. Downloads use the following URI path: / all_Dowloads / xyz , where xyz is a number Although the email application uses / youremail @ address / messages / X / attachments / 0/1 / Best / false Therefore, you cannot use pathPatterns . You should also use

  <data android:scheme="content"  />

to successfully get the intention to shoot than the scheme = "file".

ATM i use

<data android:mimeType="*/*" /> 

to check the above paths, but it provides my application as an option for each type of attachment.

<data android:mimeType="application/octet-stream" /> 

narrows the types of attachments, but this is not ideal.

, mime, .

+4

Source: https://habr.com/ru/post/1527067/


All Articles