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

Devv

Active Member
Licensed User
Longtime 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
Longtime 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
 
Upvote 0

Devv

Active Member
Licensed User
Longtime 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")
 
Upvote 0

Devv

Active Member
Licensed User
Longtime 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 ?
 
Upvote 0

luke2012

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