How To Solve Discovering Other Device Via Wi-fi (android Api)?
recently I follow the steps given from Developer.Android.Com But it seems i have a few luck over there. I tried to discover the available peers nearby, put 'em into the arraylist b
Solution 1:
I guess you did't add PeerListListener to your activity. so it won't reply.
you can try to implement PeerListListener in your activity
publicclassChat1ActivityextendsActivityimplementsWifiP2pManager.PeerListListener
and override onPeerAvailable method in your activity
@OverridepublicvoidonPeersAvailable(WifiP2pDeviceList peers) {
//put your code here
}
and change requestPeers method in your Receiver
if (mManager != null) {
mManager.requestPeers(mChannel, mActivity);
}
Hope this help!!
Solution 2:
Have you check whether your device support Wifi Direct? Having a rom > 4.0 does not means it has wifi direct hardware support. Try to check that with PackageManager's API: http://developer.android.com/reference/android/content/pm/PackageManager.html#hasSystemFeature(java.lang.String)
Post a Comment for "How To Solve Discovering Other Device Via Wi-fi (android Api)?"