I have a feeling you imported the wrong Channel. You may have imported
java.nio.Channels.Channel
when the one you want is
android.net.wifi.p2p.WifiP2pManager.Channel
hope this helps.
Pergunta
So I'm trying to create p2p connection work on android. And I am stuck on following part. code below is what's provided on API and it does not make sense to me. I feel like there must be a type for a mManager and the type is not given. How do I make this Work?
Link to API: http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html
@Override
Channel mChannel;
public void onCreate(Bundle savedInstanceState) {
....
mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
mChannel = mManager.initialize(this, getMainLooper(), null);
}
Solução
I have a feeling you imported the wrong Channel. You may have imported
java.nio.Channels.Channel
when the one you want is
android.net.wifi.p2p.WifiP2pManager.Channel
hope this helps.
Outras dicas
I used alljoin in my project. This api very successfully communicate two devices.
The type you are looking for is:
WifiP2pManager manager;