I'm trying to create an Android App which would allow my Galaxy SIII to connect to my Arduino Board through Bluetooth using a eBay cheap module I just bought.
Thing is, I can't figure out how to make a proper connection and such.
I looked lots of things over the internet, found dozens of source codes, but I still don't understand how it works (I might be dumb, at least a little bit). Some of the source codes I found are very complicated with lots of possibility, and I'm still in the learning process.
Obviously I tried the http://developer.android.com/ but didn't understand it all.
My question is : Would it be possible to describe me what is required (step by step) to make a connection using an Insecure Rfcomm (I read that online, I might be wrong).
For example : First you need to activate Bluetooth and enable the discovery, then to create a socket ... stuff like that.
I'm obviously willing to have more information than what is written above. (Dunno if willing is very polite, English isn't, as you might have seen, my mother tongue).
For now, I managed to activate bluetooth when checking a checkbox, or if the bluetooth is already enabled, my app check automatically the checkbox. Well what I did is pretty basic, still it works.
My project is basically to send a letter or some letters to my Arduino so that it can interpret it and switch on and off a LED (pretty simple).
And since I'm curious and eager to learn, I want to develop my own app instead of using an already existing one.
In advance, thanks for your time, and thanks for reading my whole message :)
Have a good day !
PS : My code goes like that : http://pastebin.com/k9sSGTuC
Related
So, what I want is just to scan the environment and see if any packages are sent without pairing or connecting to a device. Just a general scan of bluetooth in the air and being able to see some of what comes up, like packages exchanged and maybe some information of them. Everything I've read so far is about pairing or connecting first.
Thanks in advance!
The question is old, but since nobody gave an answer I try to fill the gap.
Bluetooth is, because of its technical specifications (frequency hopping etc.), difficult to sniff. A monitor mode like in WiFi doesn't exist out of the box. You would need to scan all Bluetooth channels at the same time. And then there is the challenge that since you managed to detect something, you need to know the next hop (to which channel the devices jump next). There are commercial hardware that can do that. Also some open source projects come up like Ubertooth, but with less capabilities.
You could try to purchase an Ubertooth and play with it.
I have a very specific answer for which I am looking. I hope that there is someone out there that is smart enough as to point me in the correct direction.
Background: I have an Android phone (LG Power on 5.0 rooted) as well as a Nexus 10 running 6.0. In my house I have set up a very nice PA system to which I would love to stream audio. I am fully capable of plugging in a 3.5mm cord to listen to audio or to stream audio over WiFi.
However, I am a stubborn person and have always fancied the idea of streaming audio from one device to another via bluetooth. After all, Android is Linux.
After searching on the Internet, quite extensively, there seem to be MANY people who would love to find a solution. There are answers ranging from:
'This cannot be done',
'Why would you ever want to do that?'
to
'Here are all the things to may need. Build away. Oh and by the way, there may be more that you need'
I do not find these answers satisfactory and would like to put out there a request to all of higher intelligence than myself to find an easy (not requiring building a custom ROM, modifying the kernel, making my own application etc) way to achieve this goal.
Here is one source that seems to be very close to the answer:
Android device as a receiver for A2DP profile
If any more info is needed, PLEASE ASK!
Thanks in advance for all of the hard work and effort that is put forth on this site. I am truly thankful for all of the people willing to set aside time to help myself, an invalid when it comes to the intricacies of Android.
I know that this question has been asked before many times but not recently and the API have changed so Google might have fixed some bugs. I was thinking it might be possible with two ways.
1st: Using Bluetooth Low Energy API of Android and then use android as central mode to scan for Bluetooth devices(iPhone). That is similar to what here edoardotognoni asked, which it is seems after some seconds iPhone is rejecting him. I am still currently reading about this post and the raised issue he made but I mentioned it in case someone knows something has changed.
2nd: Using and WiFi-Direct. About this method I have not found anything but If it is possible for two Droids to connect why can't it be possible for a Droid and an iPhone to connect. I have read about that matter this answer.
I also found this example on GitHub iPhone part, Android part.
Unfortunately I am not very good with xcode so I don't know exactly what is written in the iPhone part.
edit: Actually after searching I already found that it is possible with BLE but not with WiFi-Direct since iPhone does not support it. Of course being able to do it does not mean it is easy. Despite that though I have not yet found concrete proof because all I have seen is theories, an xcode that I don't understand and an Android code which seems to work when I checked it, but I have not run it.
Any help will be much appreciated, sorry for the long post!
I've seen a few people ask this in a couple of different ways, but the answer was always too complex or not detailed enough.
I want to take a survey of a lot of people at a robotics competition. I ask them questions, and mark the answers on my android-based device in check boxes, radio buttons, pull-down menus, etc. In fact, I will have multiple people working with me and asking people the same questions as me. I'll have one person at a laptop staying at his table. Whenever someone gets a few people to fill out the form, they need to put the data on the laptop. There lies the problem.
We won't have WiFi in this location. We probably will have Bluetooth, I'm not sure, but it seems like using a USB connection will be the easiest method(correct me if I'm wrong). I have a "Sync" button. When they press "Sync", the android device should send all of its new data to the laptop, and the laptop should send all of its new data(from the OTHER people surveying) to the android device. I'm using java on both devices. How do I do such communication?
That is what I want, but if I need to make it easier, I'd be willing to cripple the program to this:
You can only store one form at a time, and the "sync" button will simply send that 1 form from the android device to the laptop, and the laptop won't send any data back. That'd be fine because they really should send the file to the laptop after every form, and they don't really need the forms.
Edit: if Bluetooth is easier, please say why. My guess (if it is easier) is because each Android device might have a different port to connect to the laptop, but I think Bluetooth is harder because I'm not sure how to pair the device to the laptop.
What you should do:
Every phone used to survey should already be paired to your laptop. You should know how to do this.
Have your forms, etc, do your Android app without the communication part first, and be sure to store your forms locally correctly.
For transfer you just open BluetoothSockets on both PC and Android. Have a look at the BluetoothChat example. It's pretty simple. Remember that, since the Android starts the connection it should be Client, while the PC is a Server. Here is the Android documentation page.
For logical sync of both PC and smartphone, you should have some sort of protocol. For example at first they both say what form numbers they have (PC might have forms number 1-19, 21, 23) (Android might have form numbers 20-23). Then they will exchange exclusive information only.
Don't forget to vote up if it's useful information.
OK i know there are much threads about this topic. But most of em are like 2 years old. Because of that and the fact of new developments from googles side like ADK and stuff, im starting this question again.
All i want to know is, whether it is possible to establish a USB connection to an USB-Device now or not. Like to open a stream to receive the data from a sensor. Think about a device which can be the USB-Host and sends data permanently. All i wanna do is to grab that data.
Im using a smartphone with Android 2.3.6.
Are there any APIs now for this version? Or i have to go a way which includes a modification for the linux kernel or the usage of arduino or a similar interface? Because i would like to avoid that.
Most usb stuff starts coming into play with 3.0 > but I believe its back ported to 2.3 (not sure on it) but basically yes it is possible now. If you can get your device to be a usb host device you shouldn't have a problem, I use an acer iconia a500, running ics, I have a picaxe connected to an ftdi chip feeding me sensor data, once you have the basics sorted out its easy, if you go through my questions and find the usb related ones you should get a lot of information, ill link you if you want to the questions?
In short its entirely possible with the newer versions of Android, however back porting that functionality might cost you the same in time as it would in money to buy a new tablet or phone.
Heres everything I've talked about with usb on here... this stuff should save you a few hours I think https://stackoverflow.com/search?q=user:1174869+[usb]