Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
433 views
in Technique[技术] by (71.8m points)

android - Bluetooth File Transfer

I am developing a Bluetooth application based on the Bluetooth Chat Example from the Android Developer Site. I need to do File Transfer via Bluetooth. Can anybody help me out?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In case of transferring the files you can make an explicit call to ACTION_SEND using intents as shown below.

You can send a file to a paired device through obex in a couple of ways:

With the ACTION_SEND intent, that will popup a menu with the application that can handle the file type you want to send, from which the user will need to select bluetooth, and then the device.

Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpeg");    
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("/sdcard/file.jpg")); 
startActivity(Intent.createChooser(i, "Send Image"));

I think this will help u . :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...