There's a way I can send a file to an android device (wich already has my app installed) without paring or the app making the pairing in the background? (Without user intervention)
In my country just few people have data plans in their phones, so I want to create some kind of "server" using a raspberry and a bluetooth dongle so everytime an user with my app it's inside my store, I can show them notifications (with images and text) using the bluetooth connection insted of their cellphone data. (To detect they are in my store I can use geofences or regular beacons)
BLE is not intended to send files with huge size, since it can maximally send 20 byte chunks of data at a time. I'll definately go for the standard Bluetooth protocol if you have a file consisting of a huge size.
The pairing notification depends on how the app has been developed. If you know the device address (MAC address as unique ID) of the remote device beforehand, then you can make a simple "if" statement that checks whether the device address of each discovered device equals the one you have defined. If yes, then you can establish a connection. As a result, the app will automatically establish a connection with the desired device.
Related
I am creating an android application in which I have list out the Bluetooth devices which the user has added recently and my requirement is if the user going to login with some other mobile device there also i display the already paired Bluetooth devices Here if the Bluetooth device is enabled with the PIN pairing option I have got the all the detail of the Bluetooth device like MAC Address,Serial No and PIN details here what i want to do is in the background itself while getting the list of devices from the server i need to do the PIN pairing for d particular device I mean here I don't need to wait for the device presence from the given details i need to create the BluetoothDevice Object.
I assume your app is want to let user to migrate the paired device smoothly between different devices. If you are building your app on Android, I mean fi you do not hijack(get the root privilege) the system, the answer is NO. You can only got the MAC address, but you can not get the PIN(here the PIN I assume should be the linkkey/LTK which is used for encrypt the link).If the PIN here is pincode, it is meaningless since the pin code may vary, and only used for pairing.
I'm trying to do several things at once with a single NDEF message on a tag, and I'm starting to wonder if Android actually supports what I want to do.
When I touch the phone to the tag, I want to
Start my application
Configure my application with the MAC address of a bluetooth device stored in the tag.
Pair the bluetooth device with minimal user interaction
Open a BluetoothSocket from my application to the bluetooth device.
To this end, I've created an NDEF message (I've heard android only supports 1 message), with several NDEF records.
The first is a URI record for my company's website, and I've registered an intent filter in my app to be able to catch this record.
The second is a Handover Select record containing the bluetooth mac address of a device, and randomized C and R values.
The third is an AAR record specifying my application package.
So on to the problems:
If I put the handover select record first, Android will silently pair (GOOD!) and attempt to connect to the target device (BAD!), without ever notifying my application (BAD!)
If I put the URI record first, Android will notify my activity with all the bytes on the tag (GOOD!) but I have no way to silently pair (BAD!) or make use of the randomized numbers in the Handover Select record (BAD!). I don't see any obvious way to re-fire the Handover Select record so another activity can handle the pairing (BAD!)
In a perfect world, it would silently pair bluetooth, and notify my app so I can connect to the remote device. Is there any way I can do this?
As the topic name suggests, what I am looking for is to add my android app the option to send data to a different phone running the same application so the receiving phone will process it accordingly.
The obvious option for me was to use app engine and use push notification with the phone number acting as the identifier.
Does a simpler solution exist?
Thanks ahead :)
The best and most robust solution is to have something like your messaging clients, in which Device A sends data to the server, which pushes it to Device B. Device B sends a reply to the server, which pushes it to Device A.
This process has the advantage of retrying the sending without requiring your users to stay connected, as may be required if Device B is offline when A sends a message.
A less foolproof solution is to have a server work as a middle man, and get each device's IP Address, and then open up a direct socket between them. In this solution, you'll lose any data that doesn't make it through.
If the devices are on the same network or in Bluetooth range, you could try Bluetooth or WiFi direct.
May i achieve that server side application (using android bluetooth API)connect to particular client if i already know client's device name (as saved at servar side app in its database)? How would i handle it? some idea /Code example?
i am making class survey app for android devices using bluetooth ( i am using bluetooth chat example given by android developers) where one device behaves as server (an app for teacher) and all other devices behaves as clients (an app for students) and connect to server and download the quiz.Solve it and get the result back. i have done this part. but i need to know how can i assure that authentication on bluetooth, i mean only well known devices (clients) as saved in my database (at servar side app) can connect to my servar side app and all other clients are ignored and can't distrub the system(because a student might have my client side app and can connect easily but the student is not well known by the app as saved in my database). it is important for my app as i want that only particular group of students can access/connect to server side app. All others are ignored. A code example would be nice . i would really appreciate your time
In standard Android installs (i.e. not in a custom ROM) you can only connect between 2 paired devices. If a student's device is not paired with the teacher's device no connection will be possible.
If a student's device IS paired with a teacher's device already but the student shouldn't be connecting you will need to do the access control yourself using either the Bluetooth MAC address or device name: you probably want to use the MAC address, given that the name can be trivially changed but the MAC address is MUCH harder to change.
I'm looking for some input on how to go about a problem I have. We have a device that has binary data that it needs to send out (they are mainly just symbols, but in a custom binary format) over ethernet. I need to intercept this data on the phone and display the symbols over google maps. I'm just wondering the best way to go about this, I have a few ideas but am not sure if they are possible or feasable:
Is it possible for the phone to connect directly to the device if the device had some sort of server running on it, then poll for new data? If so, what is the protocol needed to be able to direct connect like that?
Perhaps modify the device software to send data to the phone(s) in SMS data message format? Im not sure if it is possible for software to "spoof" an SMS to a phone when it is not a phone itself?
Have the device software upload all its binary data to a ftp/http server that is sitting out there somewhere, have the phone(s) connect to that server and poll for new data periodically?
I'm brand new to android development, basically all I want to do is grab this binary data from the device on my phone and parse/display it over google maps. How do any of those ideas sound, or is there a much easier way I am overlooking? Thanks!
Is it possible for the phone to
connect directly to the device if the
device had some sort of server running
on it, then poll for new data?
Possibly, if they are both on the same WiFi LAN.
If so, what is the protocol needed to
be able to direct connect like that?
You would have to ask the manufacturer of your device. We have no way to know.
Perhaps modify the device software to
send data to the phone(s) in SMS data
message format?
If it is a GSM phone or a CDMA phone, perhaps this would work.
Have the device software upload all
its binary data to a ftp/http server
that is sitting out there somewhere,
have the phone(s) connect to that
server and poll for new data
periodically?
This has the advantage of working with the device over 3G, as the phone and device do not have to be on the same network -- they both just have to be able to reach that server. With Android 2.2, you could also use C2DM to tickle the phone to let it know there is data to be picked up.
For connection type, you can choose between Bluetooth, WiFi or GPRS/3G. What's best for your case depends on how close is the device to the phone and what connection capabilities it have.
You must also decide how connection will be initiated - by phone or by device. The only reliable option for a server on the Android phone is Bluetooth. Wifi is restricted for opening server sockets, and GPRS/3G is carrier dependent. If the device runs a server, you can access it via WiFi if it's on the LAN or Internet, for GPRS/3G it has to be on Internet.
Once you choose these things, you're left with the choice for protocol, but it's a long way to it for an answer at that stage.