Intercepting the ACTION_CALL intent on HTC sense
Asked Answered
Z

3

7

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>
Zanze answered 17/6, 2011 at 11:36 Comment(5)
It might be that the priority of HTC dialer is highest and they are aborting the broadcastIronstone
If that is the case, then their phone should not have passed the CTS.Watchcase
I guess i should atleast let all of you know that i have spent a lot of time and effort on finding the solution to this query. The reason being that not only am i fond of solving such queries as a new comer but also that reward points make me feel that my work is appreciated. As you all know that there are no personal gains in solving a query here so atleast i expect that Matt should be professional and reward me the points as promised. Lets compliment each other going forward in this forum by strictly following the professional etiquettes.Sudderth
Hi Neeraj, the bounty was posted on behalf of Scott who is out of the office until the end of the week. I know nothing of the issue and so cannot judge any answers submitted. If an answer is accepted by Scott, I will award the bounty. In the spirit of professionalism, please be patient.Dignify
Thanks for the communication. But as mentioned earlier i was more eager to receive a reply whether the solution i gave solved the purpose or not. Rewards is a secondary issue which i just conveyed. Thanks anyways.Sudderth
S
4

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.

Sudderth answered 20/6, 2011 at 15:34 Comment(0)
D
0

It's should work for you

<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>

for mode detail read there

Dyson answered 8/12, 2011 at 15:54 Comment(0)
F
0

I have met the similiar question. I can not use

adb shell am start -a android.intent.action.CALL -d tel:12345

on my real phone. But it can work on the emulate device.

Fantasia answered 10/1, 2020 at 2:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.