I'm trying to create a hotspot using startLocalOnlyHotspot()
my code:
var ssid = "null"
var password = "null"
wifiManager.startLocalOnlyHotspot(object : LocalOnlyHotspotCallback() {
override fun onStarted(reservation: LocalOnlyHotspotReservation) {
super.onStarted(reservation)
if(reservation.wifiConfiguration != null) {
ssid = reservation.wifiConfiguration!!.SSID
password = reservation.wifiConfiguration!!.preSharedKey
}
}
}, Handler())
I trying to get SSID and password from startLocalOnlyHotspot()
I put default value for them both as "null"
as string just to test
because I'm using this value to generate QR-code so I need string
and this value never changes however it creates a hotspot
what did I miss??