I am trying to create a WI-FI Direct network with say 3 tablet PCs. I want to run WiFi-Direct as background service, with one device set as autonomous GO. Could someone please tell me how can this be done in Android? Also someone please tell me how we can set dedicated SSID and passphrase so that any time new devices are added to this network, they can search for a specific ssid and passphrase for connection establishment during the application initiation ?
I am using Android API Level 18 for my development ...
Thanks in advance ...
This is how an autonomous Group Owner is created i.e. using the following code you can deliberately set a device in Wifi direct Network as a Group Owner
manager.createGroup(channel,new WifiP2pManager.ActionListener()
{
@Override
public void onSuccess()
{
Toast.makeText(WiFiDirectActivity.this, "Group Created",Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int reason)
{}
});
You can use this code on any event like Button click etc.
Bluemoon10 was almost right. I can't comment yet because I need 50 reputation :/. The config.groupOwnerIntent ranges from 1-15 with 15 being the highest intent to be group owner. If 2 devices try to connect with both GO intents == 15, the connect call will fail. If there is a GO intent tie lower than 15, the devices agree on a tie breaker bit and will succeed. So if you want one device to be group owner, you have to make sure that it is the only one trying to be. You can do this with Service Discovery, i.e. if there is a service running set your GO intent to 15 on the device with the service and 1 on the connecting device. Only one device needs to call connect to initiate connection.
Link to Service Discovery tutorial: http://developer.android.com/training/connect-devices-wirelessly/nsd-wifi-direct.html
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