Android Question Intent to share/send a file via Bluetooth ?

Devv

Active Member
Licensed User
Hi
How could i make a share intent to share (send) a file via Bluetooth ?

for example if i want to share the file /sdcard/1.apk how to do so with intent ?
 

chrjak

Active Member
Licensed User
You can use this code to share a file:
B4X:
Sub SendFile(Dir As String, FileName As String)
   Dim In As Intent
   In.Initialize(In.ACTION_SEND,"file://" & File.Combine(Dir, FileName))
   In.SetType("*/*")
   StartActivity(In)
End Sub
The use will be able to choose Bluetooth from the list.
Hey,

When I try this and i click on email the path it in the "To" line and nothing is in attachments.
Dropbox and other apps are crashing as well. Do i have to set the file path into an extra? The code is the same as above....
Please help me :)

Regards

Update: Filemanager manages to send the file. So the problem is not the file
 

Devv

Active Member
Licensed User
Where is the file located?
B4X:
Dim In As Intent
           In.Initialize(In.ACTION_SEND,"file://" & File.Combine(File.DirRootExternal, "So Market/So-Market.apk"))
           In.SetType("application/vnd.android.package-archive")
 

Devv

Active Member
Licensed User
B4X:
    Dim In As Intent
       In.Initialize(In.ACTION_SEND,"file://" & File.Combine(File.DirRootExternal, "test.txt"))
       In.SetType("*/*")
       StartActivity(In)
even this is not working with me ...

it is working for you ?
 

luke2012

Well-Known Member
Licensed User
The default Bluetooth directory in the target device is the same for All Android devices?
 
Top