質問

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);
}
役に立ちましたか?

解決

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.

他のヒント

I used alljoin in my project. This api very successfully communicate two devices.

The type you are looking for is:

WifiP2pManager manager;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top