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.
Related
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
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!
I am looking to make a messenging application for both Windows and Android over Wi-Fi. I have looked around for answers and have come back with a loads of articles that mention Client-Server applications, which is what I want to be using, but they do not mention clearly how everything works or where to start. Could anyone point me in the right direction?
Extra Information:
If possible c# for the server-side as Im more skilled in c# than other languages although I don't mind learning a new one.
Articles I've Read:
http://csharp.net-informations.com/communications/csharp-socket-programming.htm
http://www.dreamincode.net/forums/topic/33396-basic-clientserver-chat-application-in-c%23/
I am new here so I am sorry if my question has already been answered I just could not find an answer!
So I have this first year project in university with a Lego Mindstorm Robot. We are programming the robot on the lego software which is quite easy. We had the robot do a certain function when he receives a message via Bluetooth. The only problem is that the program that we found on the play store wants the user to type in the message and press send but this is not good enough for our project as we need to use our phones as remote controls to turn the robot left and right. So I want to ask you is it too hard to create an android app that consists of 4 buttons each sending a message as follows: left, right, up and down? So far the only programming apart from the lego one I have done is Python and I am only familiar with the basics of it (types, functions, classes, loops, if-statements and the turtle module). From what I have heard Python can't be used to program android so thats why I am asking you guys for help!
Thank you very much in advance! I hope I have made myself clear on what I need to know!
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.