Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intercepting the ACTION_CALL intent on HTC sense

I have an Activity to catch ACTION_CALL intent via intent-filter and route via my app which works fine on Nexus one, Moto Blur, and Samsung devices. But not on HTC sense. :(

The Intent.ACTION_CALL_BUTTON is called when the HTC sense button is pressed but when you dialed ACTION_CALL isn't received the log output shows the android.intent.action.CALL is sent.

06-17 12:22:45.173: INFO/ActivityManager(83): Starting activity: Intent {
act=android.intent.action.CALL dat=tel:00390642200001 flg=0x10000000 
cmp=com.android.phone/.InCallScreen (has extras) }

I'm guessing this is because HTC have put their own sense dialer and it's doing something funny (maybe with intent filter priority?).

Updated1: tried setting the priority to max int value, no change.

<intent-filter android:priority="2147483647">
    <action android:name="android.intent.action.MAIN"  />
    <action android:name="android.intent.action.CALL"  />
    <category android:name="android.intent.category.DEFAULT" />     
</intent-filter>
like image 818
scottyab Avatar asked Jun 17 '11 11:06

scottyab


1 Answers

You may surprise but you are right. I have done so many experiment on this topic on HTC Desire and I found that HTC made some change either in Package Manager or added some wraper around that, so whenever we add activity which has action CALL then it is not added with ACTION CALL. They do this only for CALL action not for DIAL. To find out this I have done some experiments as:

1. Created an application registered with ACTION DIAL. So whenever there is a call to __ACTION_DIAL__ intent activity then HTC displays two options one for Dial its own and other is mine Activity. Another way to test for Dial is go to Call History in HTC phone and select any phone number or contact and select **Edit number before calling**. This will also display two option to choose one.

2. Since they disable the CALL feature by programatically, all other ways to call is done by interaction with UI of HTC. So I have found another way to call by programatically and that is use <action android:name="android.intent.action.CALL_PRIVILEGED" /> in my manifest file. But this time again due to their changes I am not able to handle Call action directly but another way to handle CALL is when the android look for ACTION_CALL_PRIVILEGED. And fortunately I found that. Just go to People -> View Contact. Then It shows the option to call. In HTC Desire there is Call mobile. So press and hold that option.

Bamm.. This time HTC shows the option to select one option to call. One is its own and another is, of course, my own.

Final conclusion is you can't handle CALL but CALL_PRIVILEGED in some cases only. To make sure Use skype application on your HTC and go to People -> View Contact and then press and hold Call mobile/home then this also shows the dialog to choose the handler for Call.

like image 116
Neeraj Nama Avatar answered Sep 21 '22 10:09

Neeraj Nama