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

查看:46
本文介绍了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();
    }

但是账号是和应用绑定的,当我删除app的时候,它也删除了账号.我希望它独立于应用程序.

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 settings 活动,他们不必通过系统导航,但可以将帐户添加到系统.

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天全站免登陆