diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt index a90c11e4..4fdad918 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt @@ -88,38 +88,40 @@ data class SoftApConfigurationCompat( } @get:RequiresApi(30) - private val getAllowedClientList by lazy { + private val getAllowedClientList by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("getAllowedClientList") } @get:RequiresApi(30) - private val getBand by lazy { SoftApConfiguration::class.java.getDeclaredMethod("getBand") } + private val getBand by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("getBand") } @get:RequiresApi(30) - private val getBlockedClientList by lazy { + private val getBlockedClientList by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("getBlockedClientList") } @get:RequiresApi(30) - private val getChannel by lazy { SoftApConfiguration::class.java.getDeclaredMethod("getChannel") } + private val getChannel by lazy @TargetApi(30) { + SoftApConfiguration::class.java.getDeclaredMethod("getChannel") + } @get:RequiresApi(30) - private val getMaxNumberOfClients by lazy { + private val getMaxNumberOfClients by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("getMaxNumberOfClients") } @get:RequiresApi(30) - private val getShutdownTimeoutMillis by lazy { + private val getShutdownTimeoutMillis by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("getShutdownTimeoutMillis") } @get:RequiresApi(30) - private val isAutoShutdownEnabled by lazy { + private val isAutoShutdownEnabled by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("isAutoShutdownEnabled") } @get:RequiresApi(30) - private val isClientControlByUserEnabled by lazy { + private val isClientControlByUserEnabled by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("isClientControlByUserEnabled") } @get:RequiresApi(30) private val classBuilder by lazy { Class.forName("android.net.wifi.SoftApConfiguration\$Builder") } @get:RequiresApi(30) - private val newBuilder by lazy { classBuilder.getConstructor(SoftApConfiguration::class.java) } + private val newBuilder by lazy @TargetApi(30) { classBuilder.getConstructor(SoftApConfiguration::class.java) } @get:RequiresApi(30) private val build by lazy { classBuilder.getDeclaredMethod("build") } @get:RequiresApi(30) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt index b0b8ca6f..d5dbb793 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt @@ -1,5 +1,6 @@ package be.mygod.vpnhotspot.net.wifi +import android.annotation.TargetApi import android.net.wifi.SoftApConfiguration import android.net.wifi.WifiManager import androidx.annotation.RequiresApi @@ -17,7 +18,7 @@ object WifiApManager { @get:RequiresApi(30) private val getSoftApConfiguration by lazy { WifiManager::class.java.getDeclaredMethod("getSoftApConfiguration") } @get:RequiresApi(30) - private val setSoftApConfiguration by lazy { + private val setSoftApConfiguration by lazy @TargetApi(30) { WifiManager::class.java.getDeclaredMethod("setSoftApConfiguration", SoftApConfiguration::class.java) }