采用了android拨号器的第三方应用程序 [英] using android dialer in 3rd party app

查看:183
本文介绍了采用了android拨号器的第三方应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

家伙。我试图构建一个Android的VoIP的应用程序。我想利用内置的Andr​​oid手机拨号器。你们能不能给我一些参考吧。我一直在谷歌上搜索,没有运气。谢谢

解决方案

您需要做的是建立一个意图过滤的活动要拨打电话。你这样做在你的的Andr​​oidManifest.xml 的文件。修改您的活动定义为包括这个意图过滤器:

 <意向滤光器>
    <作用机器人:名称=android.intent.action.CALL/>
    <类机器人:名称=android.intent.category.DEFAULT/>
    <数据机器人:计划=电话/>
&所述; /意图滤光器>
 

注意:有一些另类的方式来号召人们(可以看到在的Andr​​oidManifest.xml 我联系​​娄源,然而,这是主要的一个

添加这会给用户在拨打电话时要使用你的应用程序的选项,这可以被设置为默认应用程序,如果用户希望。

您可以再拿到电话号码,加入这样的事情code到你的活动你的的onCreate()方法:

 最终意图I = getIntent();
最后乌里phoneUri = i.getData();
 

phoneUri 的现在包含的电话:00000000000 的,你可以很容易地获得数出的乌里

如果您在未来的问题,看看href="http://android.git.kernel.org/" rel="nofollow"> Android源的如果你想看看手机应用程序源的。

guys. I am trying to build a voip app for android. I want to make use of the built-in android phone dialer. Can you guys give me some reference to it. I have been googling with no luck. Thanks

解决方案

What you need to do is setup an Intent filter on the Activity you want to make the call. You do this inside your AndroidManifest.xml file. Modify your activity definition to include this intent filter:

<intent-filter>
    <action android:name="android.intent.action.CALL" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="tel" />
</intent-filter>

Note: there are some alternative ways to call people (which can be seeing in the AndroidManifest.xml of the source I linked bellow, however this is the main one

Adding this will give the user the option to use your app when making a call, and this can be set as the default app if the user wishes.

You can then get the phone number by adding something like this code to your onCreate() method of your activity:

final Intent i = getIntent();
final Uri phoneUri = i.getData();

phoneUri now contains tel:00000000000 and you can easily get the number out of the Uri object

If you have problems in to future take a look at the android source. I got these bits of code from the phone app source if you want to take a look.

这篇关于采用了android拨号器的第三方应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆