采用了android拨号器的第三方应用程序 [英] using android dialer in 3rd party app
问题描述
家伙。我试图构建一个Android的VoIP的应用程序。我想利用内置的Android手机拨号器。你们能不能给我一些参考吧。我一直在谷歌上搜索,没有运气。谢谢
您需要做的是建立一个意图
过滤的活动
要拨打电话。你这样做在你的的AndroidManifest.xml 的文件。修改您的活动定义为包括这个意图过滤器:
<意向滤光器>
<作用机器人:名称=android.intent.action.CALL/>
<类机器人:名称=android.intent.category.DEFAULT/>
<数据机器人:计划=电话/>
&所述; /意图滤光器>
注意:有一些另类的方式来号召人们(可以看到在的AndroidManifest.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屋!