I am trying to connect my smartphone to two microcontrollers with RN42 bluetooth module.
I am able to communicate with both of them individually, but when I open start the connection with the second one, the first one is closed.
I used the Multi Bluetooth Chat example as starting point. But I really don't if that example is more focus on connecting several slaves to one master instead of connecting one master to several slaves (that is my case).
I don't know if I should give you my project, it is to many lines and actually is almost exactly the same than BluetoothChatMulti project. Anyway if some you need it just ask for it.
I have been looking for a solution in forums and on Internet but I didn't find the solution to my project. Hope any of you have been already by this problem and can help me.
Best Regards!
Related
I have 2 android applications 1st is running on android 4.4 and 2nd will be contemporary. I want to setup one to one communication between these two using socketIO, there will be thousands of such pairs at a time communicating with each other. How can I achieve this?
I have already tried and able to setup a communication with fixed port by following these websites https://socket.io/get-started/chat/. and https://socket.io/blog/native-socket-io-and-android/
Is it possible with or without knowing port in advance or any another method possible to achieve the need? Please elaborate the logic or any sample available to follow.
Thanks in advance.
Checked so far : this stack post, this one and official docs
I am not really familiarised with the Bluetooth api, yet I couldn't find something to clarify based on my need.
What I am trying to achieve is: Using my android device (as server in this bluetooth connection) to push data to the other device (which can be on any platform)
Seems simple, and I might think about it in a complicate way (was thinking I might provide some interfaces / callbacks to the client part)
Also, my implementation should not affect the client side.. I am a bit stuck into this, if anyone could clarify it a bit, or come up with a decent sample where the code is described a bit,
Thanks in advance, and Happy Coding !
your phone can act as a master(host) device Here is a example you can implement
https://github.com/bauerjj/Android-Simple-Bluetooth-Example
this example uses Bluetooth to connect with HC-06 module but you can use it with other devices
I am trying to add support for bluetooth devices like headsets/headphones/car stereo to my android app which allows user to make SIP/VoIP calls. I am trying to mostly address the requirements of Answering and Ending of calls using button on bluetooth headsets, other buttons/features handling is good to have.
With the search I have done and all the text I have read so far, I have come across the following-
One common way suggested everywhere is registering to ACTION_AUDIO_STATE_CHANGED. But this doesn't really helps me. Intents for it are sent every time the button on Bluetooth headset is pressed And also when we start the ring tone on bluetooth headset.
A very common solution I found was use of Bluetooth Adapter class. There isn't much you could do with it. So again not helpful.
Another approach I came across is the use of Vendor specific headset events. After some efforts I was able to get this working for specific Plantronics Bluetooth headsets. Supporting Jabra is important.
One more approach I came across is binding with IBluetoothHeadsetPhone.aidl, the way the phone app does it. I could find very little information on it, not enough to go ahead and implement any thing.
If anyone has done such things, I think the problem I am facing is not an uncommon one, I just believe it is not documented well.
Any pointer, approach, link would be appreciated.
I will try to add more info as I find any or any other approaches I try. Please ask for details if you need any more on the solutions I have tried. And please suggest changes instead of just flagging the question.
Thanks in adv.
Sorry about the late post. I was able to find a solution for this issue. It is not simple fix.
You need to use ConnectionService from Android telecom framework. Check out this link here & here. After this your VoIP calls will have cellular call like treatment.
I realize that this is the kind of question that frequently gets a lot of (well deserved) "what have you tried" comments and down-votes, but I'm hoping that by the time I'm done asking I can avoid that.
I've been looking around but unable to find the answer to how one goes about writing an application that consists of the following three things:
An Android app that connects to a host device via bluetooth
Communication io layer that sends signals back and forth on
that bluetooth connection
A host resident native app (preferably Unity3D, or AIR) that can receive/send messages back and forth to the connected app.
I have written many Android applications so I am not in need of any kind of "getting started" hand-holding, rather I just need some guidance (preferably in the way of a web link or book tutorial) on what it takes to utilize bluetooth and how one actually communicates via it.
Thanks in advance for all useful tips.
Here are a few links that I found in terms of Bluetooth connections
First of all the dev guide(I assume you have already looked here, but if not this is a good place to start)
http://developer.android.com/guide/topics/connectivity/bluetooth.html
http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html
This one is a basic tutorial on how to Bluetooth on android
http://luugiathuy.com/2011/02/android-java-bluetooth/
This is a long PDF on Bluetooth programming in general (I haven't read it, but from what I have seen it looks over in depth) it covers java and OSX, but not android
people.csail.mit.edu/rudolph/Teaching/Articles/BTBook.pdf
Here is a similar SO question which might contain helpful links
Code samples for Android Bluetooth programming
This is the best Bluetooth open source project that I could find for android, it doesn't fit your description over well, but here it is anyways
http://code.google.com/p/bluetooth-remote-control/source/browse/#svn%2Ftrunk%2Fsrc%2Fpro%2Fapus%2Fblueremote
I realise that a lot of these links are simpler than what you really want, if I find anything more complicate I will add that.
I already read following question and answers.
How to communicate between same application installed on two android handset?
I think the use case is totally same as mine.
But I still have a remaining question - what does 'using internet' in the article above mean between two phones each far away?
I think I need some more explanation in detail.
Thanks in advance.
Yes, two applications can talk over the internet (or bluetooth or sms/mms for that matter, but less practical). Just like any two computers can communicate over the internet. There's a wide variety of protocols. A whole world really. Do you need references to some tutorials on networking or am I totally missing your question?
EDIT: You can try The TCP/IP Guide for an intro
EDIT: And for android you probably want to use their socket interface
UPDATE: About how to communicate between clients - you probably don't want to rely on knowing a particular peer's IP address. Usually what you do is work with some known host as a server, which coordinates between the peers, sometimes relaying the messages between them, or alternatively just notifying the clients about each other's addresses.