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.