Search code examples
androidapiandroid-intentsdkandroid-3.0-honeycomb

Intent for call does not open dialer


I am using Intent to make calls from my app.

Here is the onClick for the TextView on which if the user clicks I want to open the dialer:

txtCall1.setOnClickListener(new OnClickListener() {
                  public void onClick(View arg0) {
                      Intent callIntent = new Intent(Intent.ACTION_DIAL);
                      callIntent.addCategory(Intent.CATEGORY_DEFAULT);
                      callIntent.setData(Uri.parse("tel:"+ci.getContactPhone1()));
                      startActivity(callIntent);  
                  }
              });

My problem is that with Api level 12 devices instead of dialer a dialog opens which asks to add the number to contact. This is not the case for Api level 19 or 18.

This is tools I am using. I have just updated my everything. enter image description here


Solution

  • My problem is that with Api level 12 devices instead of dialer a dialog opens which asks to add the number to contact

    That is because API Level 12 devices (Android 3.1) all were tablets without dialers.

    What am I supposed to do?

    Ignore API Level 12, as approximately zero devices use it.

    Beyond that, if your app must run on a phone, add <uses-feature android:name="android.hardware.telephony"/> to your manifest, to indicate that your app requires telephony capability, so you are not distributed to tablets without dialers.