# hdc-join-wifi **Repository Path**: baijuncheng-open-source/hdc-join-wifi ## Basic Information - **Project Name**: hdc-join-wifi - **Description**: HarmonyOS连接wifi热点的样例 - **Primary Language**: Java - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 3 - **Created**: 2021-03-29 - **Last Updated**: 2025-01-06 ## Categories & Tags **Categories**: harmonyos-communication **Tags**: None ## README hdc-join-wifi ============= A simple app for making it possible to join a certain wifi access point from HDC without requiring a rooted device. Also supports modifying proxy settings. Since there is no way to start Ability by hdc command in HarmonyOS as adb in Android OS, it is currently only support for hard coding to join a wifi accesspoint. Modification of proxy setting are not supported neither. We will complete it as soon as HarmonyOS updating its sdk or supply corresponding mechanism. # Preview ![](img/wifi.gif) Usage ===== install the app: ```shell hdc app install build/outputs/hap/debug/phone/entry-debug-unsigned.hap ``` Use the Ability Manager to start the application with the appropriate parameters: (HarmonyOS does not support to start Ability with parameters by HDC, so the following commands can only be used after HarmonyOS supports them.) To join a wifi network with no password such as: ```shell hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID ``` To join a password protected wifi network such as: ```shell hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID -e password_type WEP|WPA -e password PASSWORD ``` To join a wifi network and set a static proxy (with optional bypass list) such as: ```shell hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID -e password_type WEP|WPA -e password PASSWORD -e proxy_host HOSTNAME -e proxy_port PORT [-e proxy_bypass COMMA,SEPARATED,LIST] ``` To join a wifi network and set a proxy auto-configuration URL: ```shell hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e ssid SSID -e password_type WEP|WPA -e password PASSWORD -e proxy_pac_uri http://my.pac/url ``` To clear proxy settings, simply join the same network again and do not pass proxy arguments. Device manager is not supported in harmony OS, so the following commands are not supported temporarily: To get around this for testing purposes and modify any wifi configuration, you can grant this hap device owner privileges such as: ```shell hdc shell dpm set-device-owner "com.steinwurf.hdcjoinwifi/.AdminReceiver" ``` This requires that your device has no provisioned accounts on it. If you wish to demote this app and remove its device owner privileges, run this: ```shell hdc shell am start -n com.steinwurf.hdcjoinwifi/.MainAbility -e clear_device_admin true ``` Use hard coding to set the appropriate parameters to start the application: in the MainAbility.java: ```java mSSID = "test"; mPasswordType = "WPA"; mPassword = "12345678"; ``` You can change these wifi accesspoint parameters to make sure you are connected to a cetain hotspot. License ======= hdc-join-wifi is available under the BSD license.