Gmail content

mlc

Active Member
Licensed User
Longtime User
Following this post

http://www.b4x.com/forum/basic4android-updates-questions/11535-there-way-read-emails-gmail-app.html#post64568

It seems that it is impossible retrieve the content of an email from Gmail.

Is that true?

Because there are apps such as Cloud Print, that do it, even in the case of files, getting the full file name.

My Manifest editor
B4X:
AddPermission (com.google.android.gm.permission.READ_GMAIL)

and so my AndroidManifest.xml
B4X:
<uses-permission android:name="com.google.android.gm.permission.READ_GMAIL"/>

From this intent
B4X:
(Intent) Intent { act=android.intent.action.VIEW dat=content://gmail-ls/messages/mymail@gmail.com/542/attachments/0.1/SIMPLE/false typ=image/jpeg flg=0x3880001 cmp=mlc.calendar/.main }

I get this error
B4X:
java.lang.SecurityException: Permission Denial: reading com.google.android.gm.provider.MailProvider uri content://gmail-ls/messages/mymail@gmail.com/542/attachments/0.1/SIMPLE/false from pid=6324, uid=10089 requires com.google.android.gm.permission.READ_GMAIL

I do not give up, for now. Can you help me translate this?

B4X:
InputStream is = context.getContentResolver().openInputStream(uri);

This is what I have so far :
UriString = content://gmail-ls/messages/mymail@gmail.com/542/attachments/0.1/SIMPLE/false
B4X:
   Dim Ins As InputStream

    Dim r As Reflector
    Dim Uri As Object
    Uri = r.RunStaticMethod("android.net.Uri", "parse", _
        Array As Object(UriString), _
        Array As String("java.lang.String"))
    r.Target = r.GetContext
   r.Target = r.RunMethod("getContentResolver")

Last question :)
It is possible to know the mimetype of the intent?

Thanks for your help
 

mlc

Active Member
Licensed User
Longtime User
ok, Thanks Erel

Maybe I misunderstood something of that link, English is not my language, but in my device, the version I have of Gmail is 2.3.6, however CloudPrint can access the contents of Gmail.
 
Upvote 0
Top