0

How can I hard-code a WiFi network connection for an Android Open Source project?

I will have a device that is within a network, and would like the device to automatically connect to that network and ONLY that network.

HyperionX
  • 1,332
  • 2
  • 17
  • 31
  • Seems like you may be looking something like https://stackoverflow.com/questions/8818290/how-do-i-connect-to-a-specific-wi-fi-network-in-android-programmatically?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – VVB Mar 28 '18 at 09:42

1 Answers1

1

All wifi config is saved at /data/misc/wifi, but as for now (aosp 8), the password has encrypted, so it not easy to push a prepared config to make the system auto connect to the hotspot.

As my experience, It's way easier to write an apk.

  • Thanks for your insight, would it be possible to do it still with a certificate rather than a password then? – HyperionX Mar 29 '18 at 11:10
  • It's nearly impossible, Android use wifi_splicant to control the connection of hotspot, as far as I know, there's no concept like certificate in wifi_splicant. If you really want to hard code, you can add code to WifiStateMachine, but I stronely not recommend this. –  Mar 29 '18 at 11:13