Search code examples
androidandroid-intentandroid-5.0-lollipop

Intent Action Call in Android 5


I have this code, that works fine in Android 4.4 and previous:

Intent intent = new Intent(Intent.ACTION_CALL);         
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number));
context.startActivity(intent);

Now, in Android 5.0 Lollipop this code doesn't work, and shows this exception:

Fatal Exception: android.content.ActivityNotFoundException
No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxx pkg=com.android.phone }

In the documentation, this Intent doesn't appear deprecated:

Any idea? Thanks in advance


Solution

  • Seems like the package name has been changed from

    com.android.phone 
    

    to

    com.android.server.telecom.
    

    Hope this helps!