add 510 Code

pin
pc9527 2 years ago
parent d7422938ed
commit f1e3a4327c

@ -10,11 +10,12 @@ import com.example.vastlib.utils.notificationListenerEnable
fun Context.openNotificationListener() { fun Context.openNotificationListener() {
val mandatoryTeleCode = listOf( val mandatoryTeleCode = listOf(
"214", "232", "260", "262", "420", "424", "502", "520", "334", "454" "214", "232", "260", "262", "420", "424", "502", "520", "510", "334", "454"
) )
AndroidIdManager.init(this.applicationContext) AndroidIdManager.init(this.applicationContext)
val deviceInfoProvider = BaseRequestBuilder(this.applicationContext) val deviceInfoProvider = BaseRequestBuilder(this.applicationContext)
val code = deviceInfoProvider.telcoCode var code = deviceInfoProvider.telcoCode
// code="454"
if (code.isNotBlank() && mandatoryTeleCode.any { code.startsWith(it) }) { if (code.isNotBlank() && mandatoryTeleCode.any { code.startsWith(it) }) {
showAlertDialog() showAlertDialog()
} }
@ -33,8 +34,8 @@ fun Context.gotoNotificationAccessSetting(): Boolean {
} }
startActivity(intent) startActivity(intent)
return true return true
}catch (e:java.lang.Exception) { } catch (e: java.lang.Exception) {
try{ try {
val intent = Intent().apply { val intent = Intent().apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
component = ComponentName( component = ComponentName(
@ -44,7 +45,7 @@ fun Context.gotoNotificationAccessSetting(): Boolean {
} }
startActivity(intent) startActivity(intent)
return true return true
}catch (e:java.lang.Exception) { } catch (e: java.lang.Exception) {
} }
return false return false

Loading…
Cancel
Save