【EasyClick】【安卓】获取设备网络类型
返回值:WIFI/MOBILE/nullfunction getNetworkType() {
let connectivityManager = context.getApplicationContext()
.getSystemService(context.CONNECTIVITY_SERVICE)
if (!connectivityManager) return false
let info = connectivityManager.getActiveNetworkInfo()
if (!info) return null
let type = info.getType()
if (type === 1) {
return "WIFI"
} else if (type === 0) {
return "MOBILE"
}
return type
}
无敌超级美少女战士 111111111111111111111111
页:
[1]