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?
-
have you got any solution for this? – jyomin Dec 01 '16 at 04:24
5 Answers
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.

- 5,318
- 10
- 50
- 84

- 598
- 5
- 12
-
Agree 100%. I just finished porting an older app that was using WifiP2P, and now using Nearby Connections connections are far more reliable and can connect without interaction (if desired). – Bill Oct 29 '17 at 21:30
-
Is Nearby Connections compatible with iOS's Multipeer Connectivity? If you use Nearby Connections, aren't you limiting yourself to only Android? – Drake Mar 13 '19 at 23:25
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

- 221
- 1
- 5
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.
-
3Obviously neither of these are workable solutions if I intend on distributing my app. – Alexander Trauzzi Sep 05 '13 at 14:13
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).

- 463
- 5
- 15
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.

- 310
- 3
- 11