val specifier = WifiNetworkSpecifier.Builder()
.setSsid("NetworkID")
.setIsHiddenSsid(false)
.setIsEnhancedOpen(false)
.setBssidPattern (MacAddress.fromString ("10: 03: 23: 00: 00: 00"), MacAddress.fromString ("ff: ff: ff: 00: 00: 00")) .build ( )
val request = NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
.removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
.setNetworkSpecifier(specifier)
.build()
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val networkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network?) {
Log.d("AVAILABLE", "onAvailable")
}
override fun onUnavailable() {
Log.d("UNAVAILABLE", "onUnavailable")
}}