title: Android 4.2.2 Wifi-Direct adhoc network – accessing hidden android methods to set the SSID and passphrase?
body: <p>I have successfully set up an Android peer-to-peer Wifi-Direct group using the WifiP2pManager “createGroup()” method.  My Android (4.2.2) device is configured as the group owner.  Now I need to set the SSID and the passphrase for adhoc communication with a legacy wifi peer device that I would like to connect to.</p>
  
  <p>Android seems to set up a default SSID and passphrase and I am able to read these values using the WifiP2pGroup “getNetworkname()” and “getPassphrase()” methods. I could use these values, but I want to instead set the values dynamically in my code to match the values of the legacy wifi device that I would like to connect to.</p>
  
  <p>If you look through the android code for the WifiP2pGroup, listed at:</p>
  
  <p><a href="http://android.googlesource.com/platform/frameworks/base/+/cd92588/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java" rel="nofollow">http://android.googlesource.com/platform/frameworks/base/+/cd92588/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java</a></p>
  
  <p>you can see that the public methods “setNetworkName()” and “setPassphrase()” do indeed exist.  But if I try to refer to these methods within the java code on my Android device, I get the error messages:</p>
  
  <p>“The method setNetworkName(String) is undefined for the type WifiP2pGroup”,  and</p>
  
  <p>“The method setPassphrase(String) is undefined for the type WifiP2pGroup”.</p>
  
  <p>My question is:  how can I access these hidden methods that exist within the Android 4.2.2 OS as public methods of theWifiP2pGroup?</p>
  
  <p>Is there any other way to set the SSID and passphrase apart from using these methods?</p>
  
  <p>Also, why did they choose to hide these methods, and would you know if they will be made available in a future release of Android?  If so, which release?</p>
  
  <p>Thank you for any help that you can provide.</p>