3

I'm trying to create a WiFi hotspot on the newer versions of Android, the hotspot does not need internet access, just a local network. I want to be able to set the SSID and passphrase of the hotspot manually but cannot find a way to do this from an android app. (The idea is to have a Raspberry Pi device listening for the hotspot, to connect and send 'data' once it is in range - for this to happen the SSID and passphrase need to be known/configured beforehand.)

I've tried using WifiManager's method startLocalOnlyHotspot(); however, this method generates a random SSID and passphrase, which won't help me.

I did manage to find some functions that would be very helpful in generating a hotspot here. The WifiManager.java class has the setSoftApConfiguration() method and also has the startTetheredHotspot(); however, they don't seem to be available for use in Android Studio. Is there a reason these methods don't work?

I also came across the same functions that don't work here.

My question is, can I configure a hotspot and set its SSID and passphrase manually on the newer versions of android? (Preferable without needing to insert a SIM card as well, but that is another issue)

Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
Abigail V.
  • 31
  • 2

1 Answers1

2

The simple answer is NO, you cannot configure the hotspot.

  1. Only system apps can configure the hotspot. To make your app a system app, you need to sign it with the same platform key which the oem uses.
  2. setSoftApConfiguration() is a proctected/hidden API, you can get it in android studio if you use a custom SDK with exposed APIs or third party SDKs, but it still won't work without System privileges.
jox
  • 2,218
  • 22
  • 32
Vishnu S Dharan
  • 100
  • 1
  • 7