Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intent filter is not working for calling screen

I am designing a custom calling screen to show information, such as the caller's address book info, on screen during the phone conversation. My app will begin when the user presses the call button by use of an Intent Filter, after which I will fetch other information from the address book and add it to the screen.

My problem is that when the call button is pressed, my activity is not launching. Is my intent filter right? Is it even possible to intercept the phone call Intent? Please share your knowledge on handling call event.

My Intent Filter is shown below.

<activity android:name=".MyCallingScreen">
  <intent-filter android:priority="100">
    <action android:name="android.intent.action.CALL_BUTTON" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="tel" />
  </intent-filter>
</activity>    
like image 647
Roll no1 Avatar asked Dec 01 '11 10:12

Roll no1


1 Answers

In your case try to change your code following way:

<intent-filter android:priority="100">
    <action android:name="android.intent.action.CALL_BUTTON" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

It's work for me if press on a call button.

Try to use following code to intercept the call:

<activity>
  <intent-filter>
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>

For HTC some changes there:

<activity>
  <intent-filter>
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="vnd.android.cursor.item/phone" />
    <data android:mimeType="vnd.android.cursor.item/phone_v2" />
    <data android:mimeType="vnd.android.cursor.item/person" />
  </intent-filter>
</activity>

Intent with action android.intent.action.CALL_PRIVILEGED is called when you making a call from phonebook by following way: Phone Book->Contact->Phone number Long Click -> Choose make call from dropdown menu.

like image 197
Nikolay Nikiforchuk Avatar answered Sep 22 '22 01:09

Nikolay Nikiforchuk