在通过Twiiter Digits进行OTP验证时,如果用户仅使用VOLTE连接且手机上连接了WIFI,则DIGITS不会发送OTP SMS。怎么解决这个问题?
答案 0 :(得分:2)
可能的解决方案是检查用户是否在仅包(PS)运营商上,如果WIFI已连接,则向用户显示警报以关闭WIFI。
您可以使用以下代码: -
private void check_wifi_for_volte(){
TelephonyManager manager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
String carrierName = manager.getNetworkOperatorName();
Log.d(TAG,"carrierName:"+carrierName);
boolean isWifiActive =false;
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork != null) { // connected to the internet
if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) {
// connected to wifi
isWifiActive=true;
//Toast.makeText(this, activeNetwork.getTypeName(), Toast.LENGTH_SHORT).show();
} else if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) {
// connected to the mobile provider's data plan
//Toast.makeText(this, activeNetwork.getTypeName(), Toast.LENGTH_SHORT).show();
}
} else {
// not connected to the internet
// can we show some toast not connected to internet
}
boolean isPSUser = carrierName.toLowerCase().contains(<PS-CARRIER>);
if(isPSUser && isWifiActive){
Toast.makeText(this, "If you are using PS Network. Turn OFF WIFI to get OTP SMS.", Toast.LENGTH_LONG).show();
}
}