Passing values from an android device to another - android

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.

Related

fast direct communication between ios and android

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

Alternative to WiFi Direct

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.

Android, VPN, Asterisk communication

I'm trying to write a voip app for Android, using the Android SIP API (Yes, I know this only works with some Androids with version 2.3). I want calls to be routed through an Asterisk server. The calls also need to be encrypted. A problem exists where Asterisk and the Androids need to be on the same subnet (otherwise no audio is exchanged). There is a nice blog post I found at http://blog.harritronics.com/2011/06/android-gingerbread-and-asterisk-pbx.html describing the situation for those that are curious.
I'm looking to setup a VPN solution as discussed in the article as I figure this could solve the NAT issue, along with encryption. My first thought was to use OpenVPN since there is a pretty active community and the software looks pretty nice. However, after further inspection, it seems that I can only have 2 clients active on the VPN server at any given time (for the free version). Each additional client connection is $5. In short, I'm wondering if a scalable free solution exists. I would like to be able to connect somewhere around 100 android phones to this VPN to communicate with Asterisk simultaneously.
Also, I have done no VPN work previously. I'm wondering can I simply use the VPN configuration within the Android Settings? Or does there need to be an additional application? I saw that OpenVPN had a client solution for Android that only worked if the phone was rooted - this is not an option, as they are not my phones. Any advice would be greatly appreciated.
Thank you!
Not sure what you've been looking at, but OpenVPN certainly does not have any restrictions on the number of clients. Anyway, as you have found out, OpenVPN is not supported by the default Android distribution, though it is integrated in CyanogenMod. Android also has a built-in VPN client however, so you just need to find a server that works with that. As of 4.0 (ICS) it is also possible to write your own VPN implementation without rooting the phone.
BTW, the audio problem only arises if the phones are NAT-ed (e.g., connected via WiFi to your internal router, etc.). If the have global addresses, there should be no problem. If you connect over 3G that would depend on whether your carrier gives phones actual global addresses.
Another alternative is not to the Android SIP stack. There are other solutions available, and they might not have this restriction. Check sipdroid, it open source:
http://sipdroid.org/
Yet another alternative is to not try to write your own app, just use sipdroid :)
Besides the nat=yes option of Asterix I only think in one more solution. That nat option worked for me behind a router but I know that it isn't a very "inteligent" NAT traversing from Asterisk, it needs "colaboration" from the client too. The other solution could be... when I was working with that, I was using CSipSimple, it's an open source voip client for Android, may be you can look at the sources and find why that traverses works behind a router doing NAT.
If you're looking just for an Android VPN client, there are some of them, at least one with a 100% free option.
Hope that helps!

Android ad-hoc / access point connection capabilities

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.

How to utilize network for p2p file sharing on Android Platform?

I'm working on some apps for the android platform and I have two problems that I'm not quite sure how to approach, and both are closely related.
How can I send a relatively small data file from one android device to another (preferably over the internet or directly through wireless network)?
Is it possible to create a temporary p2p live data stream from one android device to another? An example application would be to stream low-res video from phone A's camera to phone B, or audio.
I would much appreciate being pointed in the right direction on either issue (File transfer or real time data transfer).
You could try to get Google's library libjingle to work on Android. It provides quite advanced NAT Traversal capabilities, which should be able to get through the carriers' firewalls.
One approach would be to use the socket classes in java.net.
To use WiFi to send data among devices, you can try to establish an ad-hoc network among the devices that will communicate. I think you can use Android's WiFi API to do that. Once you have the ad-hoc network setup, you can establish a simple TCP connection between the devices and transfer the files.
Sockets do not work between phones. I've tried with two actual phones using socket communications and there seems to be a firewall in the carriers that prevents communications on ports different than port 80. Then if you try to use port 80 you get a 'Permission Denied' exception.
One possibility is to investigate the JXTA framework. The Practical JXTA II book is available online for reading at Scribd.

Categories

Resources