Android Bluetooth Server - android

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

Related

How can I access of websocket using MIT App Inventor?

Before asking my specific question my overall objective (in case there is a better way to do it) is to log data from a particulate matter sensor (PMS) with GPS co-ordinates on my ride to/from work to see how bad the air on my commute is.
So far I have the PMS connected to a raspberry pi, and am recording values from it using a python script.
I'm recording all these logged values to to a log.txt file following the process outlined here: https://www.perrygeo.com/raspberry-pi-real-time-sensor-plots-with-websocketd.html
I've then set-up a websocket (using websocketd) from the pi, which I can access from my computer. This just spits out a current time-stamp, and the particulate matter reading I'm interested in (again following tutorial linked above).
My question is how to access the data from this websocket in an Android App - ideally using MIT App Inventor 2 (as I'm a newb in Android). My google-fu has failed me on this one.
I'm also happy to be told that a websocket is not the best way to do it - I could serve up a JSON file on a webpage instead and parse that from the android app if that'd be easier, but had thought a websocket would be better/faster.
Having done a bit more research there is an extended discussion on this here:
https://groups.google.com/forum/#!topic/ai4a/pL4bHmJKnH0
It's suggested that I might be able to use a socket rather than a web-socket - I'd also be happy to do that.
Ok, it seems to do anything beyond the basics in MIT App Inventor 2 you need to add "extensions" which is what I was missing from my google search terms.
Specifically the following extension did exactly what I was needing - hope it's of help to other people who stumble upon this question (including me in the future!):
https://community.appybuilder.com/t/websocket-client-extension/1761
Finally I noticed that using the websocketURI with the host-name of the server machine (in my case raspberrypi did NOT work - I had to use the IP address. If anyone know why that might be and how to make the host-name discoverable on android please let me know!

Bluetooth HFP support for Android App with SIP/VoIP

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.

What is involved in connecting an app to a mac via Bluetooth?

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.

How to create P2P Android Remote application?

I would like to develop a Remote application for Peer-to-peer Android Device using TCP/IP connection. once one of the device successfully remote to the other, he/she will be able to see what the other device is doing (example : doing drawing with an application, etc).
Is this possible to do or there is other way that is more efficient to do ? Any reference/road map is appreciated. code samples are greatly appreciated.
Here have pair of projects implementing a remote service and a client for it:
https://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteService/
https://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteClient/
I think this can help you..
Thanks...
If remote means on the LAN, you can use IP multicasting. If remote means the WAN, then you'll need a fully fledge P2P framework, with NAT traversal solutions, such as JXTA for example. Google JXTA and you will find info, including code samples. It is not the only solution, you could explore JGroups too.
There are UDP based P2P frameworks too. These are a bit better at NAT traversal, but you're left with the duty of putting the pieces of the puzzle (i.e., data slicing) back together.

Bluetooth remote control using android

I have an android tablet and have an application installed on it... Now i need to control this application on the tablet through my android device... is there a way to do such thing?
Explore this example project by Google
http://developer.android.com/resources/samples/BluetoothChat/index.html
see how it works and try to implement your programming skill to transform this chat application to your idea...
How ever I am assuming that you are the author of application which you have desire to control.
happy coding.
EDITED:
Logic structure is simple both application should be able to detect bluetooth and paired(connect) with each other for communication. once you have communication instead of sending message(in chat) you send some information via buttons which will execute some methods on tablet...Just a thought... As if in chat application you can update and add messages to your thread...this application will help you to reach goal. Lot of work though!
If you are familiar with Sockets, this shouldn't be a problem for you, because the Bluetooth-connection and communication in Android is very much the same. See the Bluetooth-Tutorial and Googles "Bluetooth-Chat" example.

Categories

Resources