I am looking for the best, if any, programmatic way of connecting two or more Android phones to each other through the use of either Bluetooth or preferably, Wi-Fi. Apparently Android devices still do not have ad-hoc Wi-Fi capabilities and I am trying to create a peer based program without the use of any central server.
I want to accomplish this without the use of modification to the phones (no rooting). It is even fine to have a phone act as an access point with no Internet access to its clients if that is possible, I just need a mobile network.
I have 2.2 on my Android phone and it does have tethering - it can create a wireless access point then other devices can connect to it.
To prevent it having the internet, just turn mobile internet off.
The short answer is, you can't directly through the SDK. Some phones / revisions may have factory or other support to do so, but you can't rely on the SDK to do this.
Related
I want to send and recevice data between .NET application and Android Device by using USB. However, due to the security concerns, I do not desire to use Android Debug Bridge (USB debugging).
Is there any possible way to send and receive data from Android Device to my .NET application on computer by using USB ?
Thanks in advance.
There are many ways to skin this particular cat, let me name two:
Simple message files via MTP. Pro: Easiest to implement and widest possible client support. Con: High latency. Good, if you have few requests with a bigish payload each.
USB networking via CDC-ECM. Pro: Allows easy extension to full networking. Con: Not so broad client suppoort. Good, if you have full control over the hardware.
The prevalent problem is, that the fragmentation of Android allows you to assume only a very low baseline.
I do recommend, that you revisit the encrypted network connection option: It should be quite trivial to create a minimal network consisting only of the Android device and a single partner - e.g. by pluging a WLAN access point directly into a secondary network interface of the workstation - and by being associated to a special WLAN you make sure, that the device at this point is not connected to a different WLAN or mobile network.
This will not only be easiest, but also give you the best starting point if you want to upgrade to a broader network later on.
at the moment I'm planning to build an cross-plattform app (iOS/android) that streams music from one device to others without internet. Now I'm considering which network technology is best for this use case. By the way I'm sorry I didn't say hello to you, it disappears all the time.
Existing wifi network:
I don't wanna use this because I want my app to work everywhere.
Wifi-Direct:
Not supported by iOS (tell me if I'm wrong).
Bluetooth:
Here I've found kind of conflicting information.
Bluetooth 2.1 is supported by both iOS and android but iOS has its own protocols and doesn't support the common ones.
Bluetooth Low Energy provides a data rate that is too slow for high quality music streaming (1Mbit) and is supported by iOS but on the android side version 4.3 is required which suspends about half of all users.
What I'm not sure about is the "normal" (not LE) usage of Bluetooth 4.0. Does anyone have experience/information about this?
Creating a wifi hotspot:
This was my first idea and probably it's the best. But there are several issue:
Some carriers do not allow hotspots
It's not possible to create a hotspot without cell reception on the iPhone and some (I don't know which exactly) android devices.
It's not possible to create a hotspot without cellular data activated on an iPhone; I don't know what about android devices (Nexus 4: no problem, SGS3 mini: cellular data can be switched off after creating the hotspot)
-> that's a problem for those who don't have an internet unlimited plan or for those who don't want to share their internet connection (as this dissipates the high speed volume) but see the next point for that.
In order that everyone can use his own cellular data connection the wifi settings can be manually edited on iOS (remove router, DNS and search domains entries). Is there a way to do so on android as well? Is there way to automize this process?
https://apple.stackexchange.com/questions/173894/can-i-connect-to-wifi-but-still-use-cellular
Is there any way to create a wifi network programmatically (not just enable the normal wifi hotspot)?
SDKs/Frameworks like Open Garden or Alljyon looked promising at the beginning but:
Firechat (which is made by the Open Garden team) promises that iOS and android devices can chat locally without existing network but actually it didn't work for me with an iPhone 6 and SGS3 mini. However they don't want to publish their SDK. The only information I got is that it works over wifi-direct and bluetooth. If anyone has an idea how this could work, please tell me.
Alljoyn does not provide direct communications between iOS and android without an existing network. (Tell me if I'm wrong)
API's:
iOS multipeer connectivity does not support android
I hope anyone can help me.
Regards Nils
If you are talking about a TVBOX device with Android, you will need the ethernet cable connected in order to create a hotspot.
Another option that I have done is:
Create a service that runs on iPhone with an interfaz, do whatever you want on that interfaz, then send what ever you need to a webservice, then in Android, just pull that info from another App as a service, or just store it in an internal sqlite.
Good luck
I'm trying to develop an application that, when run on two or more devices, will be able to send data to each other at high speed. Bluetooth is not an option because of the distance. I wanted to use Direct WiFi, but it's available only on Android 4.0 and onwards. Even though I have devices with Android 4.0.3, it's still not functioning. The discovery function is not present in this version I think. I've tried looking for alternatives, such as WiFi Tethering but the device needs to be rooted in order for it to work. Moreover, there's no tutorial explaining how it works. Can anyone give me another alternative to WiFi Direct, which would enable me to create an AdHoc network on the fly?
Nowadays, you can use the new NFC communication, but, if your phone doesn´t have WiFi Direct... It is not going to have NFC communication. Anyway, i hope this may help you.
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.
I'll explain the problem I'm trying to solve first. I have two Adobe AIR applications that can be deployed to Android (Receiver App and Broadcaster App). The Receiver App sits on one Android device and waits for any Android devices running the Broadcaster App (on the local network). This is all currently working and I can have the devices talking over a local WiFi connection with no problem.
The issue is I need to be able to do this without an external router/AP. I was able to setup a third Android device as a Wireless AP and have two other Android devices communicate over the WiFi connection just fine. However, the device setting up the Wireless AP connection is not able to join the network.
After searching google and stackoverflow I came up with a few solutions.
(1) Set up an Ad-Hoc network using a rooted Android device and running Barnacle. I was able to try this and set up an Ad-Hoc network successfully between two devices but they were not able to establish a connection in the Adobe AIR apps (using Adobe P2P support).
(2) If I can get my hands on the new Android 4.0 Galaxy Nexus I understand I'll have access to WiFi-Direct. I'm curious if this will solve my problem. Can I set up AND join a Wireless AP using the Galaxy Nexus, and connect to the Wireless AP from my older 2.X devices? Reading this makes me believe I can, but I wanted to know if anyone can confirm.
P.S. I am using NetConnection/NetGroup/NetStreams on the Adobe AIR side over a serverless rtmfp connection.
Thanks.
Sean, this may not answer your question, but I've used rtmfp for serverless p2p also (of the kind described in this blogpost by Tom Krcha) and have a couple data points for you:
Many HTC devices and other smartphones have a multicast issue that prevents them from communicating in this way. Google 'htc multicast' and read about it on this blog. Interestingly, these devices can work in such a group as long as there are non-impaired devices also, because they can transmit multicast, just not receive it. So the other devices initiate the group and all can participate. But the impaired devices can't initiate the group by themselves.
I had no trouble communicating between a range of devices, from Android to iOS to desktop, so I assume you should be fine across versions of Android.
I have a rooted phone that I run an app called 'wireless tether' to create a hotspot / wifi access point, and when two other devices connect to that hotspot, they can communicate with each other using this method, but they cannot communicate with the phone that is creating the hotspot network.