Android 拨号器应用程序
我正在想办法从自定义拨号器应用程序中替换默认拨号器应用程序,但我不知道如何实现这一点。
这就是我想要的
- 创建一个自定义拨号器 UI
- 每当按下呼叫按钮硬件或 Android 中的按钮硬件时,都会调用我的应用程序
- 该应用程序也可以从我所指的联系人屏幕调用
I am figuring out a way to replace the default dialer application from my custom dialer application, but I am not getting how to achieve this.
Here is what I want
- Create a custom dialer UI
- My application is called whenever call button hardware or that one in Android is pressed
- The application can also be called from the contact screen
I am referring to public static final String ACTION_DIAL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
创建一个简单的 Android 应用程序(我们的拨号器)。要实际呼叫某人,您只需要该方法:
授予您的应用程序在 AndroidManifest 中调用的权限
在 AndroidManifest 意图中设置,让您的手机在需要拨号器时使用您的应用程序
当有人按下通话按钮时:
当有人触发 URI 时:
Create a simple Android application (our dialer). To actually call someone, you just need that method:
Give your application permission to call in AndroidManifest
Set in AndroidManifest intention that says to your phone to use your app when need a dialer
When someone press the call button:
When someone fire an URI:
这对我有用:
This worked for me:
请参阅 此答案,作者:arekolek 。
这是通过第三方应用扩展 InCallService 的正确方法,在用户接受启动时的提示后,它将替换系统默认的拨号器和 InCallScreen。
他还提供了一个 Kotlin 语言的工作示例应用(加分)。
请在那里投票支持他的答案,我不应该因为他的工作而受到赞扬。
注意:仅适用于 API 23+,并且可能需要 额外权限API 26
Refer to this answer by arekolek.
This is the correct way to extend an InCallService by a third-party app, that will replace the system default dialer and InCallScreen after the user accepts the prompt at startup.
He also provides a working sample app in Kotlin (bonus points).
Please upvote his answer there, I do not deserve credit for his work.
Note: will only work for API 23+, and might need extra permissions in API 26
ACTION_DIAL 意图似乎允许您传递一个号码来呼叫标准拨号器,准备好供用户调用它(如果他们希望这样做),所以这不是您所需要的。
您是否有具体问题,或者您是否正在寻找某人告诉您如何实现按下软件/硬件调用按钮时调用您的应用程序?
看起来您需要 ACTION_CALL_BUTTON - http://developer.android.com/reference /android/content/Intent.html#ACTION_CALL_BUTTON
The ACTION_DIAL intent appears to allow you to pass a number to call to the standard dialer, ready for the user to call it, if they wish to do so, so isn't what you need.
Do you have a specific question, or are you looking for someone to tell you how to implement your app being called when the software/hardware call button is pressed?
Looks like you need ACTION_CALL_BUTTON - http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL_BUTTON