android - Check that wifi direct is connected -


i need check phone connected wifi direct phone play, developed on framework of andengine.

  protected boolean conectadowifi(){     wifip2pmanager connectivity=(wifip2pmanager)activity.getsystemservice(context.wifi_p2p_service);     final wifip2pmanager.channel channel = connectivity.initialize(activity, activity.getmainlooper(), new wifip2pmanager.channellistener() {         @override         public void onchanneldisconnected() {         }     });      connectivity.discoverpeers(channel, new wifip2pmanager.actionlistener() {         @override         public void onsuccess() {             if (wifip2pmanager.wifi_p2p_state_enabled == 2) {                 // wifi direct mode enabled                 system.out.println("-----------wifi direct on-");             }             if (wifip2pmanager.wifi_p2p_state_disabled==1){                 system.out.println("-----------wifi direct off-");             }         }         @override         public void onfailure(int i) {             system.out.println("+++++++++++off wifi++++++++++++++");         }     });         return true; } 


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -