Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Devices do not necessarily need <code>Context.TELEPHONY_SERVICE</code> to make phone calls. Consider what happens if you install Skype: </p> <ul> <li>Enter a phone number on the native Dialer/Phone app and press "Call". </li> <li>A popup appears titled "Complete action using" and offering "Dialer" or "Skype" applications (it could list other applications too).</li> </ul> <p>So, I believe Skype would work on a wifi-only device with no phone capabilities (according to <code>Context.TELEPHONY_SERVICE</code>).</p> <p>I think you were correct with your original idea, but you need to check what applications are registered to handle <code>Intent.ACTION_CALL</code> instead of <code>Intent.ACTION_DIAL</code>, e.g.</p> <pre><code>Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:5551231234")); List&lt;ResolveInfo&gt; callAppsList = context.getPackageManager().queryIntentActivities(callIntent, 0); </code></pre> <p>However, I am not aware of any reliable, forward-proof ways of figuring out if those applications will be able to handle the phone call. Consider these cases: </p> <p>1) A wifi-only Xoom with Skype installed. It needs a valid wifi connection, and the user must have configured Skype to use their account, otherwise the call won't succeed.</p> <p>2) A telephony enabled device with no SIM card in, or a SIM card that is locked or has run out. The device thinks it can handle telephony, but the call results in a "Not registered on network" error.</p> <p>3) A telephony enabled device with no wifi or mobile connection (or because it is in Airplane/Flight mode). The device thinks it can handle telephony, but the call will fail.</p> <p>There are ways you could detect some of these scenarios (e.g. inspecting <code>getSystemService(Context.TELEPHONY_SERVICE).getSimState()</code>), but I think this would probably lead to fragile code that may break when things change in future. For example, could you always reliably detect which application in the list is the default Dialer/Phone app? What if Android changed the package name for it in a subsequent release.</p> <p>Hopefully that gave you some useful information - I wanted to show this is more tricky that it might appear at a first glance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload