拦截 HTC sense 上的 ACTION_CALL 意图
我有一个 Activity 可以通过 intent-filter
捕获 ACTION_CALL
意图,并通过我的应用程序进行路由,该应用程序在 Nexus one、Moto Blur 和 Samsung 设备。但不适用于 HTC sense。 :(
当按下 HTC sense 按钮但拨打 ACTION_CALL 时,会调用
未收到日志输出,显示 Intent.ACTION_CALL_BUTTON
android.intent.action.CALL
已发送,
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) }
我猜这是因为 HTC 已经安装了自己的感应拨号器并且正在执行此操作。一些有趣的事情(也许与意图过滤器优先级有关?
更新1:尝试将优先级设置为最大 int 值,没有变化。
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可能会感到惊讶,但你是对的。我在 HTC Desire 上对此主题做了很多实验,我发现 HTC 在程序包管理器中做了一些更改,或者添加了一些包装器,因此每当我们添加具有操作 CALL 的活动时,它就不会添加 ACTION CALL。
他们这样做只是为了 CALL 操作,而不是为了 DIAL。为了找出这一点,我做了一些实验:
1. 创建一个注册到 ACTION DIAL 的应用程序。
因此,每当调用 __ACTION_DIAL__ 意图活动时,HTC 都会显示两个选项,一个用于“拨号”自己的活动,另一个是“我的活动”。
测试 Dial 的另一种方法是转到 HTC 手机中的通话记录,然后选择任何电话号码或联系人,然后选择 **拨打前编辑号码**。这还将显示两个选项以供选择。
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.. 这次 HTC 显示了选择一个选项进行通话的选项。一个是它自己的,另一个当然是我自己的。
最后的结论是,您只能在某些情况下处理 CALL,但只能处理 CALL_PRIVILEGED。
要确保在您的 HTC 上使用 skype 应用程序并转到人员 -> 查看联系人,然后按住呼叫手机/家庭,然后还会显示用于选择呼叫处理程序的对话框。
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.
它应该适合你
有关模式详细信息,请阅读此处
It's should work for you
for mode detail read there
我也遇到过类似的问题。
我无法
使用
adb shell am start -a android.intent.action.CALL -d tel:12345
在真实手机上 。但它可以在模拟设备上运行。
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.