Java Code Examples for android.net.wifi.p2p.WifiP2pGroup#getNetworkName()

The following examples show how to use android.net.wifi.p2p.WifiP2pGroup#getNetworkName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WifiDisplayController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private WifiDisplaySessionInfo getSessionInfo(WifiP2pGroup info, int session) {
    if (info == null) {
        return null;
    }
    Inet4Address addr = getInterfaceAddress(info);
    WifiDisplaySessionInfo sessionInfo = new WifiDisplaySessionInfo(
            !info.getOwner().deviceAddress.equals(mThisDevice.deviceAddress),
            session,
            info.getOwner().deviceAddress + " " + info.getNetworkName(),
            info.getPassphrase(),
            (addr != null) ? addr.getHostAddress() : "");
    if (DEBUG) {
        Slog.d(TAG, sessionInfo.toString());
    }
    return sessionInfo;
}
 
Example 2
Source File: WifiDirectHandler.java    From WiFi-Buddy with MIT License 6 votes vote down vote up
public String p2pGroupToString(WifiP2pGroup wifiP2pGroup) {
    if (wifiP2pGroup != null) {
        String strWifiP2pGroup = "Network name: " + wifiP2pGroup.getNetworkName();
        strWifiP2pGroup += "\nIs group owner: " + wifiP2pGroup.isGroupOwner();
        if (wifiP2pGroup.getOwner() != null) {
            strWifiP2pGroup += "\nGroup owner: ";
            strWifiP2pGroup += "\n" + p2pDeviceToString(wifiP2pGroup.getOwner());
        }
        if (wifiP2pGroup.getClientList() != null && !wifiP2pGroup.getClientList().isEmpty()) {
            for (WifiP2pDevice client : wifiP2pGroup.getClientList()) {
                strWifiP2pGroup += "\nClient: ";
                strWifiP2pGroup += "\n" + p2pDeviceToString(client);
            }
        }
        return strWifiP2pGroup;
    } else {
        Log.e(TAG, "WifiP2pGroup is null");
        return "";
    }
}
 
Example 3
Source File: WifiDirectGroupManager.java    From ShareBox with Apache License 2.0 5 votes vote down vote up
@Override
public void onGroupInfoAvailable(WifiP2pGroup group) {
	if(group!=null){
		mHotSpotName=group.getNetworkName();
		mHotSpotPwd=group.getPassphrase();
		mHandler.obtainMessage(Event.GROUP_INFO_AVAILABLE).sendToTarget();
	}else{
		mWifiP2pManager.requestGroupInfo(mChannel, WifiDirectGroupManager.this);
	}
}