Android Question Send File with an intent

birnesoft

Active Member
Licensed User
Longtime User
Hello,
I want to send a file.
But the Intent doesn't send it, if I select bluetooth.
any ideas
Björn


Dim i As Intent
i.Initialize(i.ACTION_SEND, "")
i.SetType("image/jpg")
i.PutExtra("android.intent.extra.STREAM",File.DirRootExternal&"/bild.jpg" )
StartActivity(i)
 

Espinosa4

Active Member
Licensed User
Longtime User
Hi,

I using this example for sending an file.sql to dropbox. It seems that it works but finally dropbox, box, megaupload, etc give an error. Can open the file.


B4X:
Sub Envio_Click
    If Msgbox2("¿Deseas ver las opciones de envío de tu móvil para reenviártelo?","Enviar a...","SI","","NO",Null) = DialogResponse.POSITIVE Then
        Dim u As Uri 'ContentResolver library
        u.Parse("file://" & File.Combine(File.DirRootExternal,"l4pro.sql"))
        Dim i As Intent
        i.Initialize(i.ACTION_SEND, "")
        i.SetType("text/plain")
        i.PutExtra("android.intent.extra.STREAM",u)
        StartActivity(i)
    End If
End Sub


Maybe the problem is in settype or putextra.
Can you help me please?

Thanks you
 
Upvote 0

Chandrashekhar

Member
Licensed User
Longtime User
Please Help.

Following code doesn't work with whatsapp.

I can pickup contact from whatsapp but after that is says "sharing failed. please try again"




B4X:
Sub button1_click
Dim u As Uri
u.Parse("file://" & File.Combine(File.DirDefaultExternal,"writeon.png"))
Dim i As Intent
    Dim hello As String
    hello = File.Combine(File.DirDefaultExternal,"writeon.png")
    i.Initialize(i.ACTION_SEND,"")
    i.SetType("image/png")
    i.SetComponent("com.whatsapp/.ContactPicker")
    i.PutExtra("android.intent.extra.STREAM",u)
    StartActivity(i)
End Sub

It works for plain tax like this

B4X:
Sub button1_click
Dim i As Intent
      
    i.Initialize(i.ACTION_SEND,"")
    i.SetType("text/plain")
    i.SetComponent("com.whatsapp/.ContactPicker")
    i.PutExtra("android.intent.extra.TEXT","HELLO")
    StartActivity(i)

End Sub

Please help..... Thanks in advance
 
Upvote 0
Top