Does Android have any built-in communication APIs that lets a native Android app running on a phone communicate with a native Android app running on Android TV? The only solution I can think of is where the Android TV app creates a socket and the client app on the phone would connect to this socket.
EDIT:
I'm looking for a solution where no user interaction is required to setup the communication. Bluetooth requires the user to pair devices. NFC requires being very close to the device.
Yep, I implemented this by two ways, since P2P is disable on a lot of Android TVs, I kept socket and firebase solution, both works:
for socket purpose:
https://jayrambhia.com/blog/android-wireless-connection-1
For firebase, I did a page where the firebasetoken is display in a QRCode, the mobile app scan it, and we send a notification with the auth params to the Android TV App wich can connect to our back end.
Does Android have any built-in communication APIs that lets a native Android app running on a phone communicate with a native Android app running on Android TV?
You have the same options that you with any pair of Android devices:
Direct ordinary sockets, if the two devices happen to be on the same WiFi LAN segment or are otherwise directly reachable, and you are comfortable with the security ramifications of having an open socket connection
WiFi Direct (where available)
Bluetooth
Indirect communication through Internet-hosted facilities (e.g., FCM) or possibly some locally-reachable server that is not on the Internet (e.g., WebRTC)
NFC, though probably few Android TV devices have NFC support
About the only thing that I can think of that might be more unique for Android TV would be those that offer an infrared (IR) receiver, but I have no idea how much apps can tap into that, and few Android devices have an IR transmitter.
There is a guide from the android developer website
https://developer.android.com/training/connect-devices-wirelessly
Network service discovery (NSD)
P2P connections with Wi-Fi Direct
Related
I've started to develop a chat application for Android. This app is supposed to function without internet and, most importantly, without an access point; It has to connect Android devices in a pure P2P manner.
However I've followed the following tutorials posted in android developers guide:
http://developer.android.com/training/connect-devices-wirelessly/nsd.html
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html#fetch
Afterwards, I've tested my app on 3 devices, the problem is one of the devices acts as an access point, preventing other devices from connecting with each other if they are connected to it.
This doesn't work for my app, because I want each user to be able to connect to multiple users at the same time.
What do you suggest I do in order to achieve pure P2P connection for my Android app?
Does the group owner acts as an access point?
EDIT
After I've done some research I found the WiFi Direct is not suitable for my project since it has to assign a device as an access point, what I'm looking for is WiFi ad hoc mode or (IBSS) in Android Anybody got any suggestion on how to start working on that?
By using bt and wifi simultaneously, you can try to extend the network further. This will require some kind of packet routing.
Also, it seems android ignores wlan cards connected to usb otg - just plugging in extra wlan dongles could allow easy extension of network.
So I am developing an APP and I need to connect multiple android and multiple Iphone to send text data without any internet connection or service provider data network.
So one of the phone will have to act as a server to relay information between them. But the app will have to decide which phone will be the server and if a phone that is the server leaves the conversation then another phone will pickup as the server this will all be done with some smart programming but before I get there.
I know Android WiFi direct can do a one to many connection setup which makes it easy to connect android phone and accomplish the task between android phone only. But the problems comes when I need to connect Iphone with the android phones. Since the Iphone must be able to act as a server as well.
I would like to know a few things:
Can I connect Android and Iphone via WiFi Direct?
Can I connect Android and Iphone using Multipeer connectivity feature on Iphone?
Is there anyway to create a soft access point using Iphone? I know android can do this via WiFi direct feature.
If non of these can work can you suggest something.
From the discussion here it doesn't look possible
I wonder though if both OS allow enough control over the WiFi transceiver if you couldn't just write an app that could what you are asking and just bypassing the built in software architecture all together. I would think Bluetooth would be too weak except in extremely dense device saturation environments, but just for proof of concept that could be another route to take. My guess though is that you just wouldn't get that level of control over any of the radios inside a phone through the current OS.
I want to make my android device working as a bluetooth headset.
I search the Android APIs, but I just find some interface which
can make Android device working as a masters, not as a device(bluetooth headset).
I'm also ready to modify the source codes of Android OS, and rebuild the OS.
What I hope is, when Android devices connect to a mobile phone with bluetooth, the Android devices can work as a bluetooth headset.
I don't know whether there are interfaces can do this, or I should modify the Android OS?
Thank you!
You need to implement HFP profile in your android device, normally phone role is AG(Audio gateway) and headset roles is HF(Hands free) , think its as a server and client role. Connect RFCOMM channel to phone using UUID defined for HF , have SDP record updated,changes will be required to handle AT Commands as well.
These will be the initial changes, once done you will need to handle audio packets(SCO packets) for voice calls
I am currently working on the creation of an application for mobile devices with Android which should be capable of sending and receiving messages through local means like wifi and bluetooth. After making a research about it I found out that Android doesn't have a native wifi ad hoc functionality and that the only way to achieve that is through rooting your device and patching the wpa_suplicant and some other similiar methods which are not generic for every device.
Synopsis of what I am trying to achieve:
An application for Android that scans for devices nearby and tries to connect to them automatically. If the other device also got this application isntalled then it automatically accepts any connection request it receives and when the connection is established it sends back a message which ensures that it has this app installed so that both can start exchanging messages automatically and the users don't have to allow/deny any of the sending/receiving in real time.
My questions are:
Is there any way of sending messages through wifi between 2 android
devices without the use of internet?
Since Ad Hoc is not supported, is there any alternative?
In case the answer to 2 is no , then is it possible to make one of
the devices to be an access point so the other can connect to it and
vice versa.
As for bluetooth, is it possible to skip or automate the allow/deny
pop up of an incoming connection and the pairing procedure?
I'll be glad if you could give me an answer to those and/or any suggestions.
You'll be able to communicate between two devices over wifi without a router/access point using Wifi Direct (P2P) in Android 4.0.
Otherwise, I don't believe you can achieve this over Wifi (bluetooth would be the next best alternative). Since 2.2 you can set your phone up to be a Wifi Access Point (for tethering your device's network connection), but during this time, the Wifi hardware is unavailable for normal use. If you had 3 devices it could work (1 AP, 2 connecting to it).
Is this for a constant connection, or a one-off small delivery? You could use NFC if you want to transmit a URL for example (Android Beam integrates this type of sharing in Android 4.0, but could implement it in 2.3).
Hi i wanna work with some bluetooth communication using my Android device.
How can i test bluetooth connections easy?
Let say im creating a simple application that will send the message "Hello World" upon connection. I would like some sort of server application console i could fire up on my iMac and have my android application connect to.
The server application should just be a console or something that displays all the data it receives and maybe a input to back a response.
Is there anykind of program that allow this ?
Or do i really need 2x android devices to create a simple server / client interaction with bluetooth?
this Android Bluetooth Chat App will be good starting point .
you can make this connect to the mac over serial port profile.
The example above is for the latest Android versions (it is possible to accomplish this with 1.x versions of android also, you will have to use the appropriate api that are supported in older android versions also)
For Programming in the Mac refer to This