I'm looking to intercept calls in order to block all calls from numbers not stored in Contacts and to avoid all sorts of notifications set by default Phone app – in status bar, on its icon (number of missed calls), etc.
All devices are Samsung Galaxy Core Duos, so I have Blocking mode as an undesirable way of blocking all calls from numbers not stored in Contacts. My main problem is finding a way to disable (avoid) aforementioned notifications. I know I can empty my call log, and I am doing it, but notifications stay, both in status bar and on icon. That being said, I believe either both or none can be solved.
Is there a way to do this for rooted devices running Jelly Bean?
Since there's no proper way of using abortBroadcast()
in this case, as android.intent.action.PHONE_STATE
is not being received via an ordered broadcast (no system's sendOrderedBroadcast()
call, like with received short message, but plain old sendBroadcast()
instead), all receivers must receive this intent "at the same time".
To make my goal possibly impossible, as far as I can see, things start happening even before the broadcast. Furthermore, nothing "legally receivable" happens before the call to sendBroadcast()
, as thoroughly yet briefly described in this blog post. By the way, this post was submitted in 2009. Has anything related to this problem changed since then?
Is it possible to solve this using shell? If yes, how?
The code that's emptying call log is the following:
context.getContentResolver().delete(android.provider.CallLog.Calls.CONTENT_URI, null, null);
I have permissions needed (for instance: WRITE_CALL_LOG
, READ_CONTACTS
, WRITE_CONTACTS
) and this works. Call log shows to be empty when I touch Phone app icon or status bar notification.
I solved it using this piece of code:
Runtime runtime = Runtime.getRuntime();
try
{
runtime.exec("service call phone 5 \n");
}
catch (Exception e)
{
e.printStackTrace();
}
It marks call as ended, instead of marking it as missed, and ended calls do not show notifications of any kind.
5が機能しない場合は、4、6、8などの他の数字を試してください。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加