清空dns缓存
private fun clearProcessBindNetWork() {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val connectivityManager = RearviewApplication.getmContext().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
connectivityManager?.bindProcessToNetwork(null)
return
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ConnectivityManager.setProcessDefaultNetwork(null)
return
}
} catch (e: Throwable) {
Log.e(TAG, e.message)
}
}
网友评论