0

I have developed an application in android using the Android Bluetooth Chat Example. https://developer.android.com/samples/BluetoothChat/index.html

I am suppose to receive data from an abc server by connecting my mobile client using Bluetooth. I have implemented Bluetooth Connectivity using RFCOMM as shown in above link. I am also able to receive text from server. However I am unable to receive Image file sent by server on Mobile Client. Server is sending image as a file using Obex FTP. Cannot post code here due to Confidentiality issues.

Can someone please tell me how to receive image in Android using Obex Protocol ? I am unable to find any API for the same in Android.

Iram Khan
  • 37
  • 2
  • 12

1 Answers1

0

I recommend you to import javax.obex library. This library has nice APIs that helps you work with OBEX protocol. However, I had some problem using the library, because I couldn't find the package from the compiler bundle. I solved this problem by copying entire source files of javax.obex linked here.

The next problem was implementing the ObexTransport, but I sloved this problem by modifying this, as it caused runtime error that some methods are missing.

The last step is to open a bluetooth OBEX server using the apis. This and this files will help a lot.

P.S. I am developing an android bluetooth OBEX telnet(?) server and going to lost my source files on github. I will let you know later if you want. Anyway I hope my answer helped.

Edit: I posted more detailed explanation here. And Github repository here.

KYHSGeekCode
  • 1,068
  • 2
  • 12
  • 30
  • 1
    I tried looking at your Github regarding this. Are you still working on that Github? It seems that most of the codes are commented out and the BluetoothOPPHelper isn't there at all. – Paula Kristin Sep 19 '19 at 11:37
  • @PaulaKristin I updated the github url. Sorry for late reply. – KYHSGeekCode Oct 15 '19 at 22:21
  • @PaulaKristin and maybe I've changed the structure of the project. Maybe you could see BluetoothBatch.java – KYHSGeekCode Oct 15 '19 at 22:24
  • thank you. Are the codes on BluetoothBatch is already using OPP? Or should I uncomment some of the codes? – Paula Kristin Oct 16 '19 at 09:26
  • @PaulaKristin I think the most interesting code for you resides here : https://github.com/KYHSGeekCode/Remote-Controlled-Android-Client/blob/master/app/src/main/java/com/kyunggi/worker2/BluetoothOPPBatch.java – KYHSGeekCode Oct 16 '19 at 17:49
  • Ok thanks a lot of helping out! I saw that BluetoothOPPBatch only has the StartBatch as the uncommented method. Is this the only one I should use? Or should I uncomment the other methods here too? What I wanted to do as to make my own custom OPP Server using Bluetooth to an OPP IoT device can receive a file from the Android Device without using the Native BluetoothOPP from Android. – Paula Kristin Oct 17 '19 at 15:31
  • @PaulaKristin See here: https://github.com/KYHSGeekCode/Remote-Controlled-Android-Client/blob/master/app/src/main/java/com/kyunggi/worker2/BluetoothBatch.java which is the superclass of BluetoothOPPBatch. The commented out lines moved up to there while being refactored. – KYHSGeekCode Oct 18 '19 at 09:17
  • Thanks, I will check it out and get back to you. – Paula Kristin Oct 18 '19 at 10:05