I am creating app in which I had to send data to phone via embedded device.
Is it possible to send file via embedded device to Android phone with Bluetooth?
I don't find any of example of it and I think I need another embedded device like dongle for implementing obex protocol.
You need to read in the bytes of the file that is being submitted by your device. Sample code that connects the android to a separate device can be found in this SO post. There is also a robust documentation of the API as well as a specific sample application. Be aware that many people are finding issues when using the sample application to try and connect the android to a separate device. The issue is explained in this SO post (see the accepted answer), but essentially the connectivity problem is caused by calling listenUsingRfcommWithServiceRecord.
I myself ran into problems with Bluetooth, but using the above resources have been able to quite successfully connect my android with an embedded device. Hopefully this aggregate of information will be of use to you.
You can use the very common UUID for SPP devices: ("00001101-0000-1000-8000-00805F9B34FB");
Related
I am new to using the RPi and just got the A+ model which I have been using to generate different types of data from external sensors. I was wondering if it is possible to send this data it is gathering to an android device in real-time, and if so the best method? I want to be able to notify the user (through a an app made with the Ionic framework) when the data enters a particular range etc.
And also is it possible to do this whilst the user is walking around with both the devices in hand?
The short answer to the question is: Yes, you can ;-)
The longer answer is much longer, since there are many ways to do this.
The one I personally would choose as the simplest is classic Bluetooth (not LE) using the SPP profile, which basically makes the BT link a serial connection between the RPi and the phone.
On this serial link you invent you own streaming protocol suitable for the data you want to transfer.
On the RPi side you install a module such as this: https://www.sparkfun.com/products/12577
(There are many alternatives, but the RN42 module is very foolproof...)
Don't know the level of your hardware skills, you might need something more plug and play if you feel uncomfortable hooking up the 4 wires needed for 3.3V power and serial communications between the Pi and the BT Module...
On the phone side you install https://github.com/don/BluetoothSerial, which gives you an API reachable from Ionic where you can receive the BT data stream.
With that and a bit of coding on both sides you are good to go.
I've used a Raspberry Pi in combination with an Android smartphone & Lego NXT.
Communication was achieved using Bluetooth on Raspbian. I used a cheap $1 USB Bluetooth dongle. The Bluetooth stack had to be compiled for Raspi, which may not be necessary anymore. Steps can be found here: Bluetooth error: Native Library bluecove_arm not available
Bluetooth seems most logical to me.
I'm at work at the moment, hence the lightweight answer, if you'd like to discuss this further then please leave a comment and I'll be happy to provide more verbose response.
You can upload the data to any cloud services. You can use Xively/Box. Xively is specially made for real time data collection.
To connect RPi to Xively, refer this: https://xively.com/dev/tutorials/pi/
For Box, refer this: http://www.sbprojects.com/projects/raspberrypi/webdav.php
You can then use Xively API in your android app. You can see GitHub for this
Google app store already has some apps for you, if you want to use
It might look a little complex. But its really simple once you follow the above methods.
I am currently trying to write an android App that is connected to a application running on a pc (even though windows is preferred linux would be ok, too) via either USB or Bluetooth. Right now I'm not really sure how far this is possible. As far as I understand the USB Android API, I can not really use USB to talk to another application. Only raw file exchange seems to be possible. The Bluetooth idea seems a lot more feasible as I see it. I'd write a bluetooth server for the PC and connect to it via a Bluetooth client written via Android API. Point is, is that possible with windows? Has anyone seen any examples for what I am looking for? All I can find for USB is teethering which is not what I want.
There are android applications which allow you to use your mobile's touchscreen act like a touch pad which can be used to control your pc or laptop via bluetooth or wifi connection just like you are using your laptop's touch pad. PremoteDroid, RemoteDroid, Gmote etc.. to name a few (or only these are available i guess!).
But to do so you also need to develop a server application which will run on the device you wish to control and help u make connection between your mobile and the device. I have used PremoteDroid and RemoteDroid and they both work well on my laptop which runs windows 7. You can even add keyboard functionality.
PremoteDroid is openly available here: http://code.google.com/p/premotedroid/
I have a Bluetooth server application on my Mac that I use to test an Android app I'm writing. The app will eventually be used to communicate with a device with a microcontroller and bluetooth modem, but I needed a way to test the app in the absence of that device. The server app is written in Java, so I think it should work on a PC (and almost certainly in Linux).
I'm happy to share the code with you--I found it somewhere on the Internet (though I can't seem to figure out where now) and modified it as I needed to. It uses the BlueCove library, and is only about 60 lines, including several imports (and the code I commented out but didn't bother deleting :). I also have a Bluetooth client program on my Mac, since my app also has server functionality.
I have never tried to do anything like this using USB.
Is it possible to pass a value from an android device to another? I mean, without using the Internet. My project will be implemented only on a localhost. The two android devices are only connected through the router. If it is not possible on the local area network how can I do this? Are there other ways? I'll use the Internet or any other options if possible. Links to open source code, if you have any particularly regarding on this topic, would be appreciated too. Thanks!
If your target is Android4.0+ you can use wifi direct as #pgsandstrom stated.
In other cases if you want to make client/server comunication with two android decices you should look at this thread Socket Server/Client with two Android devices and the awser to this question may be usefull to you too How to write an Android SocketServer to listen on wifi.
If you can restrict usage to Android 4.0 or later, then have a look at wi-fi direct. It doesn't use a router thou, so I hope that isn't a restriction. If you need to support older devices, I think you have to go with bluetooth.
For some requirement analysis I want to test a RFCOMM based bluetooth communication between two android devices.
I need to send some 1 MB of data to from Android device 1 and Android device 2 should receive it and display/save the data. I need to do this using Bluetooth SPP (RFCOMM) profile .
Can any one suggest some available app/code to do this?
Under the bluetooth documentation for Android Developers. There is the Bluetooth Chat application example which will contain an activity for facilitating the communication between two devices, as well as the service connection. This will be your best example for what you are looking to do. Here is the link to the Tutorial, you will also find a link to the BluetoothChat application under here:
http://developer.android.com/guide/topics/connectivity/bluetooth.html
To see the BluetoothChat application you will first need the Android SDKs, and then you will be able to find the source.
Generally, do some research first, as here is another question of the same sort that has a little more detail, and shows the user made a good attempt first.
Bluetooth Examples for Android
After following the BluetoothChat application, or the written tutorial on the Android Docs, if you run into bluetooth errors, and other problems with your code. Stack Overflow is definitely the way to go for receiving quality answers to your troubles!
I am making an App based on the Sample Bluetooth Chat given on the Official Android Developer website. My App works fine whilst chatting with another Android Phone. However, it does not work when I connect it to a non-Android Device (namely some electronic circuit that my team has made).
Internet Research has shown that the Sample Code is only meant to communicate between two Android Devices.
So, how do I change the Sample Code to make it work with other non-Android Devices as well.
I figured out the Answer through analysing the source-code of the BlueTerm App. Effectively, I only needed to change the UUID that I was setting in the App from fa87c0d0-afac-11de-8a39-0800200c9a66 to 00001101-0000-1000-8000-00805F9B34FB"
I'm not an expert on this area so I can't say WHY that is the case, but it does help solve my problem. The BlueTerm SourceCode is available on Official Download Website of Pymasde
the UUID is specifically for serial port connection and it's a standard.