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

The following examples show how to use android.net.wifi.p2p.WifiP2pGroup#getNetworkName() . These examples are extracted from open source projects. 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
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 Project: WiFi-Buddy   File: WifiDirectHandler.java    License: 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 Project: ShareBox   File: WifiDirectGroupManager.java    License: 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);
	}
}