3

I am trying to check if the device has telephony feature or not. But in emulator, it is always returning false. Why is it so? Am I doing something wrong.

Rookie
  • 8,660
  • 17
  • 58
  • 91

2 Answers2

0

You can also connect to an emulator console to simulate an incoming voice call or SMS. For more information, see Telephony Emulation and SMS Emulation.
End of this page: https://developer.android.com/studio/run/emulator-networking
That is normal, your emulator does't call nor it sends sms (note that Telephony includes a lot of features)

IvanF.
  • 513
  • 10
  • 18
-1

You can just wrap your code in try/catch. It works in all cases, even with the last api changes about sms sending.

try{
    // code that use telephony features
}
catch(Exception e){
    // code that doesn't use telephony features
}
quent
  • 1,936
  • 1
  • 23
  • 28