Check first SDK version to make sure that NET_CAPABILITY_FOREGROUND exists
This commit is contained in:
@@ -1214,8 +1214,8 @@ class BaresipService: Service() {
|
|||||||
val lnAddrs = mutableMapOf<String, String>()
|
val lnAddrs = mutableMapOf<String, String>()
|
||||||
for (n in cm.allNetworks) {
|
for (n in cm.allNetworks) {
|
||||||
val caps = cm.getNetworkCapabilities(n) ?: continue
|
val caps = cm.getNetworkCapabilities(n) ?: continue
|
||||||
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND) ||
|
if (VERSION.SDK_INT < 28 ||
|
||||||
VERSION.SDK_INT < 28) {
|
caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND)) {
|
||||||
val props = cm.getLinkProperties(n) ?: continue
|
val props = cm.getLinkProperties(n) ?: continue
|
||||||
for (la in props.linkAddresses)
|
for (la in props.linkAddresses)
|
||||||
if (la.scope == android.system.OsConstants.RT_SCOPE_UNIVERSE &&
|
if (la.scope == android.system.OsConstants.RT_SCOPE_UNIVERSE &&
|
||||||
|
|||||||
Reference in New Issue
Block a user