While connecting to a peer using WiFi Direct, user's permission is required. I know that connection can't be made without user never giving the permission and there's a feature request for this kind of functionality: https://code.google.com/p/android/issues/detail?id=30880
But I don't need this feature, asking for permission on the first connection is OK (also, more secure). Is there any method such that the permission is asked for the first time only? And when trying to connect to same peer later, the permission is not required.
From the P2P specification we can find something called "persistent P2P group" which is intended to re-establish a group without user-intervention.
In a persitent P2P group the Group Owner stores the credentials of the group so that the group can be re-established in the future by the request of any group member without the need of user intervention.
Such a group can be formed by specifying persistent while connecting using command line (see the P2P of wpa_supplicant
and search for p2p_connect
command https://android.googlesource.com/platform/external/wpa_supplicant_8/+/ics-plus-aosp/wpa_supplicant/README-P2P). But I don't know if the option is available with the current devices.
Edit: See the answer to the question Can I change the group owner in a persistent group in Wi-Fi Direct?
Since I worked with Wi-Fi Direct on Ubuntu, I used wpa_cli
(which comes along with wpa_supplicant
) to create a persistent group as specified in the p2p_readme
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With