当前位置: 代码迷 >> 综合 >> 连接WIFI Hotspot ,显示wifi地址
  详细解决方案

连接WIFI Hotspot ,显示wifi地址

热度:61   发布时间:2023-10-23 22:17:54.0

连接WIFI热点,显示wifi地址

//这里是可以修改hostname
alps/device/mediatek/common/device.mk 	
PRODUCT_PROPERTY_OVERRIDES += net.hostname=MyOSalps/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/mediatek/settings/wifi/hotspot/TetherWifiSettings.java 	
private void handleWifiApClientsChanged() {Context prefContext = getPreferenceScreen().getPreferenceManager().getContext();mConnectedCategory.removeAll();mBlockedCategory.removeAll();mClientList = mHotspotManager.getHotspotClients();if (mClientList != null) {Log.d(TAG, "client number is " + mClientList.size());for (HotspotClient client : mClientList) {ButtonPreference preference = new ButtonPreference(prefContext, client, this);String deviceName = mHotspotManager.getClientDeviceName(client.deviceAddress);//deviceName 设备的名称//preference.setTitle(deviceName);preference.setTitle(client.deviceAddress);//client.deviceAddress 地址//Redmine148414  modified for Hotspot null device name 2018/10/18:beginif (deviceName != null && deviceName.equalsIgnoreCase("*")) {preference.setTitle(client.deviceAddress);}//Redmine148414  modified for Hotspot null device name 2018/10/18:endif (client.isBlocked) {preference.setButtonText(getResources().getString(R.string.wifi_ap_client_unblock_title));mBlockedCategory.addPreference(preference);Log.d(TAG, "blocked client is " + deviceName);} else {preference.setButtonText(getResources().getString(R.string.wifi_ap_client_block_title));mConnectedCategory.addPreference(preference);Log.d(TAG, "connected client is " + deviceName);} }if (mConnectedCategory.getPreferenceCount() == 0) {Preference preference = new Preference(prefContext);preference.setTitle(R.string.wifi_ap_no_connected);mConnectedCategory.addPreference(preference);}if (mBlockedCategory.getPreferenceCount() == 0) {Preference preference = new Preference(prefContext);preference.setTitle(R.string.wifi_ap_no_blocked);mBlockedCategory.addPreference(preference);}}}

log:

01-03 10:11:15.113  4276  4276 E myy     : deviceName======== Honor_8_Lite-aeb132c6962f
01-03 10:11:15.114  4276  4276 E myy     : client.deviceAddress1111======== 30:74:96:ee:0e:b2
01-03 10:11:15.119  4276  4276 E myy     : deviceName======== MyOS
01-03 10:11:15.119  4276  4276 E myy     : client.deviceAddress1111======== e0:48:d3:0d:d2:96
01-03 10:11:15.125  4276  4276 E myy     : deviceName======== *
01-03 10:11:15.125  4276  4276 E myy     : client.deviceAddress1111======== 00:08:22:86:81:07
01-03 10:11:15.125  4276  4276 E myy     : client.deviceAddress======== 00:08:22:86:81:07
  相关解决方案