Question

Is it possible using the telephony (or other) APIs on an unrooted Android phone, for an application to listen for the Telephony intents (ringing / Incoming-call), and if calling party matches a criteria (such as, from a black-list), disconnect the call, without requiring a confirmation by the user ?

Also, it is possible for an application on such (an unrooted) Android phone to initiate an outgoing call without user's intervention (s.a. at a particular time or when certain conditions are met) ?

In my research so far, I've found that I'd have to use a BroadcastReceiver with the right priority, to be able to "trap" the 'ringing event', and use ITelephony.aidl to reject the call. However, it wasn't clear if I can do the latter on an unrooted phone or not.

For the second requirement, it is not clear if app can make an going call -- again, on an unrooted Android phone.

Was it helpful?

Solution

Is it possible using the telephony (or other) APIs on an unrooted Android phone, for an application to listen for the Telephony intents (ringing / Incoming-call), and if calling party matches a criteria (such as, from a black-list), disconnect the call, without requiring a confirmation by the user ?

You can easily get the state of the current call. However, hanging up yourself without user interaction is only possible through reflection.

Also, it is possible for an application on such (an unrooted) Android phone to initiate an outgoing call without user's intervention (s.a. at a particular time or when certain conditions are met) ?

You can dial a number without asking the user by using:

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);

Keep in mind that you must have the android.permission.CALL_PHONE permission, and that replacing ACTION_CALL with ACTION_DIAL will ask the user to confirm. ACTION_CALL places the call directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top