Mon*_*van 5 java android telephony android-audiomanager
I'm working on a telephony app and I need to check if a call is mobile or IP. It doesn't matter if this check is done on incoming calls or on active calls. I'm testing the IP calls with WhatsApp and Skype.
I saw another answer saying to use this method:
public boolean isVoip(Context context){
AudioManager manager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
return manager.getMode() == AudioManager.MODE_IN_COMMUNICATION;
}
Run Code Online (Sandbox Code Playgroud)
However, manager.getMode() == AudioManager.MODE_IN_CALL both for mobile calls and IP calls.
I've also looked into the TelephonyManager documentation and found the getPhoneType() method.
mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
Run Code Online (Sandbox Code Playgroud)
But mTelephonyManager.getPhoneType() returns TelephonyManager.PHONE_TYPE_GSM instead of TelephonyManager.PHONE_TYPE_SIP, even when making / receiving IP calls, so I've figured getPhoneType() returns the phone type for the current device.
| 归档时间: |
|
| 查看次数: |
68 次 |
| 最近记录: |