Android Sip学习(一)Android 2.3 APIs SIP-based VoIP

安卓官网的原文如下:

API Overview


The sections below provide a technical overview of what's new for developers in 2.3, including new features and changes in the framework API since the previous version.

SIP-based VoIP

The platform now includes a SIP protocol stack and framework API that lets developers build internet telephony applications. Using the API, applications can offer voice calling features without having to manage sessions, transport-level communication, or audio — these are handled transparently by the platform's SIP API and services.

The SIP API is available in the android.net.sip package. The key class is SipManager, which applications use to set up and manage SIP profiles, then initiate audio calls and receive audio calls. Once an audio call is established, applications can mute calls, turn on speaker mode, send DTMF tones, and more. Applications can also use the SipManager to create generic SIP connections.

The platform’s underlying SIP stack and services are available on devices at the discretion of the manufacturer and associated carrier. For this reason, applications should use the isApiSupported() method to check whether SIP support is available, before exposing calling functionality to users.

To use the SIP API, applications must request permission from the user by declaring <uses-permission android:name="android.permission.INTERNET"> and <uses-permission android:name="android.permission.USE_SIP"> in their manifest files.

Additionally, developers can request filtering on Google Play, such that their applications are not discoverable to users whose devices do not include the platform’s SIP stack and services. To request filtering, add <uses-feature android:name="android.software.sip" android:required="true"> and <uses-feature android:name="android.software.sip.voip"> to the application manifest.

For more information, read the SIP developer guide.

 以下是翻译,大家可以大概了解下,帮助和我一样英文不好,但是想学习SIP的童鞋。

对于开发商来说,在Android 2.3平台作为Android SDK的下载组件。可下载的平台包括了Android库,包括任何外部库。下面我介绍下Android 2.3开发中,其中一个新的功能和框架API---sip

SIP-based VoIP


该平台现在包括一个SIP协议栈和框架的API,让开发人员建立的互联网电话应用。使用API,应用程序可以提供,而无需管理会话,传输层次的沟通,或音频语音通话功能 - 这是处理平台的SIP API和服务透明的SIP API是在android.net.sip封装。重点是SipManager,使用的应用程序设置和管理,然后启动音频电话和接收音频呼叫。一旦音频呼叫建立,应用程序可以静音通话,在扬声器模式下打开,发送DTMF音,等等。应用程序也可以使用SipManager创建一般的SIP连接。

该平台的底层SIP协议栈和服务都在制造商和运营商自行决定相关设备。出于这个原因,应用程序应该使用isApiSupported()方法检查是否可用SIP支持前公开向用户调用的功能。


使用SIP API,应用程序必须请求用户通过声明和在其权限清单文件。

下面我举个SIP Demo的例子(源代码在下一篇中贴出)
这是一个演示应用程序强调如何使与SIP API的基于互联网的呼叫。应用程序使用对讲机风格的界面,让您只听到当按钮被按下了。 此演示应用程序源代码显示了如何完成三项与SIP关键的事情:拨打电话,接听电话,信号到Android平台,您的应用程序要接收传入的SIP呼叫,使他们可以从内部处理应用。

SipSettings 一PreferenceActivity,它提供对SIP的基本设置身份验证
IncomingCallReceiver 一个BroadcastReceiver的侦听传入的SIP电话,传递,处理他们WalkieTalkieActivity。 
WalkieTalkieActivity 一活动,登录到SIP设备供应商和寄存器接收传入的SIP协议,处理来电,使拨打电话,在通话过程中用户界面管理。

 

如果你正在开发一个应用程序使用的SIP API,请记住,该功能只在Android 2.3(API级别9)和更高版本的平台支持。

此外,在运行Android 2.3(API级别9)或更高的设备,并非所有的设备将提供SIP支持。为了确保您的应用程序只能是设备上安装能够支持SIP协议,请记住添加到Android市场发布之前以下应用程序的清单,这表明到Android市场和平台,Android的应用程序需要2.3或更高。有关详细信息,参见API级别和为元素的文档。 
要控制Android市场从设备过滤器不支持SIP,记得您的应用程序添加以下到应用程序的清单 ,它告诉你的Android应用,应用程序使用的SIP API.

声明应包含一个Android:必要的属性,表明是否要Android市场来筛选,从设备不提供SIP支持的应用。其他声明可能还需要根据您的实现。有关详细信息,请参阅该元素的文档。如需使用SIP API的信息,请参阅android.net.sip文档。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值