On iPhone if I create custom service for example "_test._tcp.local." in Bonjour I can seek/broadcast this service through WiFi or/and Bluetooth.
It is possible on Android ?
I know that there is jmDNS but from what I understand it works only through WiFi/Network,
not Bluetooth.
Thanks
EDIT by Seva Alekseyev, who offered the bounty: I'm not after workarounds (like Zeroconf sans Bluetooth or Bluetooth sans Zeroconf). I'm after the real thing.
Not on bluetooth, because Android currently doesn't support TCP/IP over bluetooth, and Android's native NSD support (network service discovery) works over IP.
It DOES, however, work over Wi-Fi. Also, Android supports service discovery over Wi-Fi Direct, which gives you greater range and battery efficiency than bluetooth. For a guide on how to integrate service discovery into a wi-fi direct enabled application, check out the Android Training lesson.
Portions of this answer are duplicated from our Dear Android video response to this question
You can use BluetoothSocket and BluetoothServerSocket to create TCP like sockets over Bluetooth.
Here is a sample of android dnssd :
https://github.com/twitwi/AndroidDnssdDemo
You may need to modify the jmdns library such that it creates bluetooth sockets if bluetooth is ON, otherwise creates simple sockets. Encapsulate the socket communication in a different class that creates socket conditionally.
There's a couple of reasons why this is not possible currently. The one most related to your question is that - as you probably experienced - jmDNS requires a TCP/IP link to publish or browse services (it requires an IP address to bind to). As the other answers & comments state, you'd need an established PANU link for that, which Android currently doesn't provide.
The other reasons it will not work are:
Apple uses a couple of mechanisms to assure iOS devices will only talk to other iOS devices. So even if you'd get Android into talking Bonjour-over-Bluetooth, it would only work Android-to-Android.
Apple certified devices in the MFi program have a special crypto chip which is supplied by Apple. I'm not sure if this applies to Bonjour-over-Bluetooth connections as well, but I'd assume it does.
You could instead look into using Bluetooth 4 LE - at least there's an Apple API for that starting in iOS 5 providing a Slave profile, and extended to support a Master profile in iOS 6.
Related
I am working on an app that will act as a dashboard for an electronic card installed in cars and trucks.
I need the application to be able to receive data from this card, so I can display it in various ways on the app.
We chose Wifi for the communication method. To access the card, my app is able to connect to a Wifi network created by it.
I would like to receive JSON sent by the card every second.
I need help on where to start to make the two devices communicate, and what are the good practices on implementing this kind of communication.
The app basically act as a client, and the card as a server.
I found something about sockets, but it seemed to use two Android devices, a server and a client, so I'm kinda stuck here.
I use Android Studio 2.1.2 with the Android APIs ranging from 19 to latest.
One option is to broadcast with UDP the data within the local network. The moment the android device connects to the wifi network it will be in its local network. So the data can be received at the android end with a multicast receiver(check out http://jgroups.org/ ).
Refer example
It may also use the p2p sharing with TCP and bind the device with static IPs for communication. Create a simple socket receiver at the android end and a service at the device end. Depends on the way you choose it.
i want to develop an android application that allows people on the same wifi network to text and call each other. i looked around and found a few theories which suggested setting up a server client network.i want the devices on the network to scan other devices with the application installed and initiate a chat. i have been using desktop version of such applications which includes outlook messenger, LAN Messenger and a few other and want to apply the same logic to mobile devices.
i have basic knowledge of java to a point where i had to develop a Point Of Sale Application for a store. I need some pointers, a starting point on how this can be achieved and what protocols i have to research to do so.
Have you tried Peer-to-Peer framework ? ..
I am developing a similar app right now, however I am not sure about voice call (although, android support SIP) but I am heading toward messaging ..
What I need to do is pair with a Bluetooth enabled device which hosts some webservices and browse for DNS-SD services.
Then I have to pick one of those discovered services and make some http requests over https or other secure method.
I already did this trough WiFi, but for some reasons there's a need to do the same trough Bluetooth.
I did some research yesterday but I haven't found what I need. I'm not sure how to approach this.
Any input on this is welcomed.
Thanks!
Most implementations of bluetooth implement sockets on top of RFCOMM or L2CAP, but these are not standard sockets.
I've never used it, but I believe that the Bluetooth network encapsulation protocol (BNEP) allows for the use of standard TCP/IP networking over Bluetooth. Android does not implement this and I don't think it is widely supported elsewhere.
I have android application the scan a Bluetooth device around, and connect them to start exchanging text.
I want the application to establish a communication with each Bluetooth device in the surrounding area and send text to all of them at once.
Is that possible to have multiple communication in android ? and if you have any examples ?
For sure it is possible. You are talking about Bluetooth BR/EDR (2.x, 3.0) or Bluetooth low energy(4.0)?
For Bluetooth BR/EDR, use the official documentation to get started.
Just do a SDP to find all devices in range that support your UUID. Here is how.
Then connect to each of them using a RFCOMM Connection as a client.
Obviously, the other devices should accept this connection. If those are Android as well, see the 'connecting as a server' chapter. (Basically it means waiting for a connection...).
For things not covered in the Android Official Documentation, see this.
You can also just take all paired devices, and try to connect to them(obviously only those in range will connect).
I want to develop an chat application to chat between two or more android devices using wifi network.The application should be able to send or receive strings from each other. I have an experience of using Bluetooth network between pc and android. Can any give me any suggestion or right direction. Thanks in advance.
You can be able to chat between two android devices in Android Version 4.0.There is an API called 'Wifi P2P'.More information can be had from here:
http://developer.android.com/reference/android/net/wifi/p2p/package-summary.html
If you are thinking about connecting devices that are under the same WiFi AP/router and without setting up any server, then I would suggest you to consider using UDP multicast which has been available since API level 1:
http://developer.android.com/reference/java/net/MulticastSocket.html
UDP does not guarantee data delivery (could be lost), so I would use UDP multicast for device discovery, and open up a TCP connection for data that requires guaranteed delivery. TCP listening port can be advertised via UDP multicast so that everyone can connect with each other over TCP. (There may be 3rd party tool that does this low level stuff for you.)
maybe XMPP will help, google talk uses the same protocol.
The Extensible Messaging and Presence Protocol (XMPP) is an open
technology for real-time communication, which powers a wide range of
applications including instant messaging, presence, multi-party chat,
voice and video calls, collaboration, lightweight middleware, content
syndication, and generalized routing of XML data.
things you need to do:
1. you need a server computer to run XMPP server, there are lots of open source implementations.
2. you need a XMPP client running on your android device, there are also lots of open source implementations running on android platform.