2013-10-08 82 views
0

所以我試圖在android上創建p2p連接工作。 我被困在下面的部分。下面的代碼是API提供的,它對我沒有意義。我覺得必須有一個mManager的類型,而且類型沒有給出。 我該如何做這項工作?在Android上使用Wi-Fi創建P2P連接

鏈接到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); 
} 

回答

2

我有一種感覺,你輸入了錯誤的頻道。您可能已經導入了

java.nio.Channels.Channel 

當你想要的是

android.net.wifi.p2p.WifiP2pManager.Channel 

希望這會有所幫助。

0

我在項目中使用alljoin。這個API非常成功地傳達了兩個設備。

0

你正在尋找的類型是:

WifiP2pManager manager;