Android以编程方式创建Sip帐户 [英] Android Create Sip Account Programmatically

查看:155
本文介绍了Android以编程方式创建Sip帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想要一个活动,使用户可以在字段中添加他的SIP帐户参数。
我不想让他们去设置->通话->互联网通话设置->添加帐户->添加

In my application I want to have one Activity that enables user to add his SIP account parameters in fields. I don't want them to go Settings->Call->Internet Call Settings->Add Accounts->Add

我创建了具有以下活动的帐户以下代码:

I have created account with activity with the following code:

SipManager mSipManager = null;

    if(mSipManager == null) {
        mSipManager = SipManager.newInstance(this);
    }

    android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.s , 0)
    SipProfile mSipProfile = null;
    SipManager manager = SipManager.newInstance(getBaseContext());

    SipProfile.Builder builder;
    try {
        builder = new SipProfile.Builder("XXXXX", "sip.linphone.org");
        builder.setPassword("XXX");
        mSipProfile = builder.build();
        manager.open(mSipProfile);
        //manager.register(mSipProfile, 30, MyActivity.this);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

但是该帐户已绑定到该应用程序,当我删除该应用程序时,删除帐户。我希望它独立于应用程序。

But the account is bound to the application, and when I delete app, it deletes the account. I want it to be independent of the application.

推荐答案

为什么不启动系统sip设置活动,并且他们没有浏览系统,但可以将帐户添加到系统中。

Why not start the system sip settings activity, and they don't have to navigate trough the system, but can add the account to system.

if (SipManager.isVoipSupported(this) && SipManager.isApiSupported(this)){
   // SIP is supported, let's go!
   Intent intent = new Intent();
   intent.setAction("android.intent.action.MAIN");
   intent.setComponent(ComponentName.unflattenFromString("com.android.phone/.sip.SipSettings"));
   startActivity(intent); }

这篇关于Android以编程方式创建Sip帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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