问题
I implement simple SIP client app for receiving calls. I go through official manual and get code from it.
I noticed that
SipManager.newInstance(getApplicationContext());
returns null. Documentation says that it happens when SIP API is not supported by device. However I use LG G6 with Android 7.0 and I successfully test third-party SIP clients from Google Play. So I doubt that API is not supported really. How could I check that?
My manifest has all permissions (INTERNET
and USE_SIP
)
Permission for USE_SIP
is granted by user
回答1:
The Problem is that Android SDK is not supported over all the devices.
you can check first whether it is supported on current device:
if(SipManager.isVoipSupported(getApplicationContext())){
Log.d("VOIP:", "Supported!");
}
else{
Log.d("VOIP:", "Not Supported");
}
if(SipManager.isApiSupported(getApplicationContext())){
Log.d("API:", "Supported!");
}
else{
Log.d("API:","NotSupported!");
}
Sometime API is supported but not VOIP. I tested on Moto E 2nd Gen.
and Moto X 2014, 1st Gen.
Both API and VOIP is not supported on Moto X and Only API is supported on Moto E, but VOIP is not.
To avoid this caveat, you can use 3rd party APIs such as Doubango.
Source: SIP on Android: This Article discusses this problem in detail and suggest alternative APIs.
来源:https://stackoverflow.com/questions/49865269/sipmanager-newinstance-returns-null