Android以编程方式创建Sip帐户
在我的应用程序中,我希望有一个活动允许用户在字段中添加他的SIP帐户参数。 我不想让他们去设置->通话->网络通话设置->添加帐户->添加 我已使用以下代码创建活动帐户:Android以编程方式创建Sip帐户,android,settings,add,sip,account,Android,Settings,Add,Sip,Account,在我的应用程序中,我希望有一个活动允许用户在字段中添加他的SIP帐户参数。 我不想让他们去设置->通话->网络通话设置->添加帐户->添加 我已使用以下代码创建活动帐户: SipManager mSipManager = null; if(mSipManager == null) { mSipManager = SipManager.newInstance(this); } android.provider.Settings.System.putInt
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();
}
但该帐户绑定到应用程序,当我删除应用程序时,它会删除该帐户。我希望它独立于应用程序。为什么不启动系统sip设置活动,他们不必在系统中导航,但可以将帐户添加到系统中
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); }
您可以将该代码放入
服务中
,并从您的活动中管理服务
@Misha您找到解决问题的方法了吗?@Vahid不幸的是,如果您正在编写自己的SIP应用程序,则没有帮助,并且需要输入的凭据(包括密码)之后通过您自己的SIP堆栈手动注册帐户。