In Android ICS, Wireless P2P (WiFi Direct) API is provided.
I tried to develop an Application which can connect 2 phones via Wireless P2P automatically if the MAC addres
In the mean time the situation has changed. You can create a wifi direct connection fully automatic using creategroup() of the WifiP2pManager and the fetch the randomly generated password and SSID with onGroupInfoAvailable(), see this description with example code.
It seems that automation of authentication dialogs is not possible, and this makes p2p routing impossible as well. Right now, the WpsInfo class (which is used in the WifiP2pConfig class that gets passed into the WifiP2pManager's connect() function during peer connection) only displays authentication dialogs in four ways: DISPLAY / KEYPAD / LABEL / PBC. I believe that PBC (push button config ) is the default and is what you refer to. The other three options require the user to input a type of pin, making them even more unusable for automated connections. Maybe if we were to find the type of this authentication dialog class, we could automate the clicking of the 'ok' button?
I wish a new option could be added that would give the application the ability to authenticate a connection, rather than the user. This user based authentication looks like its been carried over from the bluetooth api, and severely limits the usefulness of wifi direct. Maybe the folks at google could help us out?