0

So I'm considering writing a Bluetooth app for android, I'll need the following functionality:

Is it possible using bluetooth android 2.3.6

  • Broadcasting that the app is enabled to other phones with the same app running.
  • Sharing data between phones(one act as server and more than one user receive file at a same time).
  • one Phone act as server and client at a same time.
  • one android phone send and receive at a same time.
  • one phone can communicate with other when its chatting with one other device.

Thanks

Zeeshan Chaudhry
  • 842
  • 2
  • 15
  • 31

2 Answers2

1

1.) If the other phone has the same app running when you start you application, yes, it's possible to show the other phone that your app is also running but not exactly through a broadcast. You can just have a bluetooth discovery every 30 seconds and so when the other phone's next discovery happens it'll show that you are now 'online'.

2,3,4,5 are extremely tricky considering how finicky Android Bluetooth can be. So I strongly suggest you really understand how bluetooth works in Android before you embark on trying those. I don't have any concrete knowledge on how to implement those so I'll let someone else guide you on what to do. However, I do believe 3.) and therefore 4.) are possible as I've seen an app that achieved that functionality. I can't remember what it was called though.

A Random Android Dev
  • 2,691
  • 1
  • 18
  • 17
  • Thanks for your reply Vishwa. Actually i was a student and thinking for an idea for my Final Year Project.....so i wanted to know is it possible or not. – Zeeshan Chaudhry Nov 02 '12 at 18:19
  • Is it possible that i copy data from some others phone without letting others know. if both of us have same application running ? – Zeeshan Chaudhry Nov 02 '12 at 18:20
  • Yes, it is possible. However, you will be limited to only support Android 2.3 and upward. This is because you will have to use something called createInsecureRfcommSocketToServiceRecord() to pair up the phones without getting the user's consent. Once the two phones are paired up you can then send over data from one phone to another but this has to be strictly implemented in your application code i.e, you can only access certain files whose names you mention in your app code. Basically, your code will create a fileoutputstream and it will send over the data for the filename you have specified. – A Random Android Dev Nov 02 '12 at 19:09
  • What this means is that you will not be able to access all of the user's files unless, of course, the user himself sends you the file/data. – A Random Android Dev Nov 02 '12 at 19:10
  • hmmmm i think this is the key point "you will not be able to access all of the user's files unless, of course, the user himself sends you the file/data" – Zeeshan Chaudhry Nov 02 '12 at 19:17
1

Its quite simple:

With bluetooth you need to be paired with the other device, without that you cannot connect.

Once paired you can try to connect to that phone. However that phone needs to be listening for incoming BT connections.

Usually you cannot connect 2 devices twice with eachother. Once one BT connection is established, it has to suffice.

What you can do with files etc depends on the permission your app has been granted.

Once connected you have an incoming and an outgoing bytestream on each device. You can code any kind of communication or protocol with those 2, its up to you.

NikkyD
  • 2,209
  • 1
  • 16
  • 31
  • Thanks for your Answer. What about this is it possible that one device can send and receive at a same time. i mean that device A can send file to B, at the same time A is receiving file from B. is it possible. – Zeeshan Chaudhry Nov 02 '12 at 20:12
  • if you send on one thread and receive on some other thread i dont see a reason why not. However i dont know if it really works full duplex or if the transmission will be at half speed because it has to send and receive in constant change – NikkyD Nov 03 '12 at 01:10