Is it possible to automatically connect two devices without requiring the user to tap an "accept" button when creating an Android WiFi Direct P2P connection?
A bit late response but it might help someone searching for an answer.
Yes it is possible by creating Access Point as #hengsti said, but I would suggest to consider using Google Nearby Connections API instead (Nearby -> Connections API). It is much more reliable and easier to use.
Check this link https://groups.google.com/forum/#!topic/android-platform/hN5WfXRzXpI it might help. He has conducted a few experiments on the way of connection , it might help
It is possible, but your device must be rooted. See my answer to the closely related question: https://stackoverflow.com/a/18629705/1041475.
Much more complicated alternative is to build your own ROM with that patch already applied.
Once the two devices have been connected at least once, the confirmation is no longer necessary. Otherwise the other two answers cover it quite nicely, it is not possible to do so at the moment, and probably never will, at least according to this "bug" report, which was deemed obsolete by one of the Android project members (see post 46).
In the mean time this is possible, by calling creategroup(), where you instantly become goup owner of the wifi-direct connection. This creates an Access point which an client can connect to. The client can fetch the SSID and Password with a WIFI_P2P_CONNECTION_CHANGED_ACTION event, see this blog and code example.
Related
i am trying to connect two android devices using WIFI direct and i was successful. But the problem is the second device has to accept the a connection prompt after the other device initiates the connection. It is undesirable for what i am trying to achieve. I saw a few post here in stack overflow itself saying that currently its not possible. But came across an app called SUPERBEAM which user WIFI direct but without the prompt. A search in google gave me the following link from xda forum which says
SuperBeam creates an access point using Android's WiFi direct API's.
This essentially works like hotspot mode in old devices, but it is
guaranteed to work on newer devices like Nexus 7. Moreover, this mode
allows older devices to connect and receive files without having to
support WiFi direct's peer-to-peer connections and, more importantly, it
gets rid of the annoying "accept connection" prompt.
But no where i found information on how to implement this. Can anybody help me. Here is the link
http://forum.xda-developers.com/showthread.php?t=2177133
You could indeed simply use the createGroup function from the API to create a group, which also makes the access point. The first problem here is that the access point name & password are set automatically, and you can not change them.
So, you do need to pass the info to the connecting party, and for this, I would suggest using the local service advertising, and using the instance name there.
Did make simple test app for this and you can find it from Github under DrJukka/MyWifiMesh, also some discussions on the topic can be found from my blog
This can be achieve using Xposed framework. You need add the code and install the App. The phone needs to be rooted in order for it to work. I have tested it on multiple Samsung phones and it works.
Check this answer for details: How to auto-accept Wi-Fi Direct connection requests in Android
I need a way to send messages between 2 android devices, 1 a phone and 1 a tablet. I'm using Java to create the app. I'm looking at servers but I can't figure out where to start. Thanks for any help :-)
P.s. Both devices would be using the same wifi connection so could I use a port to send messages
Beside the obvious solution from #dilix you could use a library like JGroups which provides automatic discovery of other devices.
The answer depends on how far away the devices are. Right next to each other (inches)? NFC. Within about 20 feet? Bluetooth. Within a hundred meters or so? Wifi Direct, which is peer to peer wireless connections. More than that? You're going to need a central server, because no carrier allows incoming TCP or UDP data- they all firewall it off. Of course all of the longer distance answers will also work for shorter distances. But different solutions here also have different security requirements.
I think you can try sockets to send\receive messages:
http://developer.android.com/reference/java/net/ServerSocket.html
http://developer.android.com/reference/java/net/Socket.html
Try to searh "android socket" and you can find some information even on the stackoverflow.
is there a way I can force Internet access for installed apps
to only go through wifi, ie prevent any data transfer via the radio/3G
interface?
I'm looking for a solution that wouldn't require a jailbroken phone,
so I guess fooling around with iptables might be out of the question.
Please let me know, thanks.
I suppose you could use the solution for this question:
Android: Stop/Start service depending on WiFi state?
You'll need to modify it a bit, but that'll let you know when WiFi is activated and deactivated. I'm not sure what the purpose of your application is, but I certainly wouldn't recommend doing it.
http://www.liveprofile.com/
I was wondering if anyone would be able to explain roughly how an application like LiveProfile is implemented?
How do the messages get pushed over the network from one device to another. How do they know the address of the device they wish to send it to? Is there a map of IPs and LiveProfile PINs?
Is it HTTP? Just the general technology used would be a great help in improving my understanding of this aspect of Android and mobile engineering.
I don't know about that specific app, but there are several possibilities out there.
One is Google Labs' C2DM: http://code.google.com/android/c2dm/
Also, check this post. It has a very detailed explanation: http://tokudu.com/2010/how-to-implement-push-notifications-for-android/
Here is another one with useful info: http://blog.boxedice.com/2010/10/07/android-push-notifications-tutorial/
As a co-founder of LiveProfile I can shed a bit more light on what we've done.
LiveProfile was released before C2DM was available. Infact the market was fragmented and many were still using Android v2.0 and below. For this reason we ended implementing our own push based solution.
Our solution is a persisted socket to our servers at all times. When a user sends a message to another user, it gets routed through our servers and we decide who it should go to. If the persisted socket is connected then we push the data to them. If the user is not currently connected, we store the data in an queue and the user will receive all the messages on connect.
Update: A good resource is a talk from Google I/O 2009 which goes into detail about the battery life, how network / CPU effects it, etc. http://www.youtube.com/watch?v=OUemfrKe65c
I try to create an ad-hoc network between many Android devices, but I can't find documentation to do that.
I thought Wifi direct could work for what I want, but is it possible to have multiple connection on one device ? I saw that we could do a device acting like an access point and communicate with many devices, but can we communicate from one client device to two access point devices ?
I have for example 3 devices: A -> B -> C
The "A" device need to communicate with "C" device but he's too far away, so I want to have ad-hoc wifi direct connection between A&B and ad-hoc wifi direct connection between B&C, so A can communicate with C. It should also work with more than 3 devices.
Thanks !
Here is the link to the Wifi Direct Demo http://developer.android.com/resources/samples/WiFiDirectDemo/index.html
I have been working on establishing ad hoc communication over Android phones for a month. I am trying to create an app that could work without having 3G or access point. Main idea is to let the clients to be able transfer voice or data in a close range.
There are some guys implemented a basic system regarding almost the same topic. It basically works with Wi-Fi access point. So you need an access point in order to establish the connection. Although this is not what I am looking for, it might be helpful for others. You might need to contact them for more details.
https://sites.google.com/site/androidwalkietalkie/home
Android does not have support for ad-hoc WiFi at this time -- sorry!
Update (2019): Android has supported WiFi Direct for a while, and this answer has not been updated.
Your scenario would work. A would be able to connect with C as long as B (the group owner) is within range of both A and C.
See Android's developer documentation for more info:
https://developer.android.com/guide/topics/connectivity/wifip2p
At this time only Galaxy S 2 support Wi-Fi Direct
The wifi direct supports concurrent hosting and client capabilities on single interface. Which means, the device will act as an AP, allowing other devices to connect to it as clients, And also connect to another AP as a client. And can share internet connection by driving the internet traffic between the interfaces.
However, current implementations of wifi direct on android are specific to the phone and not part of andorid sdk. So there is not much clarity if they support concurrency. This capability is not limited by hardware.
Ad hoc wifi is disabled in Android. You need to ask Google why they have chosen to do so. If you have access to a device that allow you to install custom Android images, you will be able to patch Android to support it. Or you can root your device and reenable ad hoc Wifi, there are plenty of solutions on the web on how to enable ad hoc on rooted Android devices. This is a software issue, the hardware on every Android device that I know of has support for ad hoc Wifi.
The Serval Project, based in part on WiFi Tether, is the only place I've found this functionality. It's still alpha phase, but seems to be the forerunner in the field. The wiki is much more useful than the main project page linked above, with installation instructions and a bit of documentation.
Serval may or may not be right for your needs, but I felt it should be pointed out that ad-hoc networking is not impossible on Android. It might be better to wait until Google gets around to implementing it as standard API, though (if you believe they ever will :) ).
Well You might be interested in looking at AllJoyn. It is qualcoms SDK for android OS which includes wi-fi peer-to-peer implementations by creating adhoc connections. This is same as Wi-Fi Direct.