Android 台灣中文網
標題:
想請問有關 WifiP2pManager 的用法
[打印本頁]
作者:
armsman
時間:
2016-5-27 16:52
標題:
想請問有關 WifiP2pManager 的用法
想寫一個利用wifi傳輸文字的聊天室
這是我參考的網頁:
http://hukai.me/android-training-course-in-chinese/connectivity/connect-devices-wireless/wifi-direct.html
private
WifiP2pManager.ConnectionInfoListener
connectionInfoListener
=
new
WifiP2pManager.ConnectionInfoListener() {
@Override
public void
onConnectionInfoAvailable(WifiP2pInfo info) {
String groupOwnerAddress = info.
groupOwnerAddress
.getHostAddress();
log(
"位置 : => "
+groupOwnerAddress);
if
(info.
groupFormed
&& info.
isGroupOwner
) {
log(
"群主"
);
}
else if
(info.
groupFormed
) {
log(
"Client"
);
}
}
};
上便是我依照網站寫的最後一個步驟,一台裝置LOG.d 會顯示 群主 另一台會顯示 Client請問傳送資料的部分該怎麼寫呢?
歡迎光臨 Android 台灣中文網 (https://apk.tw/)
Powered by Discuz! X3.1