- Get DNS servers dynamically also then baresip is started the first time.
This commit is contained in:
@@ -138,19 +138,19 @@ class BaresipService: Service() {
|
|||||||
Utils.copyAssetToFile(applicationContext, a, "$filesPath/$a")
|
Utils.copyAssetToFile(applicationContext, a, "$filesPath/$a")
|
||||||
} else {
|
} else {
|
||||||
Log.d(LOG_TAG, "Asset '$a' already copied")
|
Log.d(LOG_TAG, "Asset '$a' already copied")
|
||||||
if (a == "config") {
|
}
|
||||||
var dnsServers = listOf<InetAddress>()
|
if (a == "config") {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
var dnsServers = listOf<InetAddress>()
|
||||||
val activeNetwork = cm.activeNetwork
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (activeNetwork != null) {
|
val activeNetwork = cm.activeNetwork
|
||||||
dnsServers = cm.getLinkProperties(activeNetwork).dnsServers
|
if (activeNetwork != null) {
|
||||||
Log.d(LOG_TAG, "DNS Servers = $dnsServers")
|
dnsServers = cm.getLinkProperties(activeNetwork).dnsServers
|
||||||
} else {
|
Log.d(LOG_TAG, "DNS Servers = $dnsServers")
|
||||||
Log.d(LOG_TAG, "No active network!")
|
} else {
|
||||||
}
|
Log.d(LOG_TAG, "No active network!")
|
||||||
}
|
}
|
||||||
Config.initialize(dnsServers)
|
|
||||||
}
|
}
|
||||||
|
Config.initialize(dnsServers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user