2014-01-08 9 views
11

私のアプリケーションでは、ユーザーが自分のSIPアカウントパラメータをフィールドに追加できるようにするアクティビティが1つあります。 私は彼らが行きたくない設定 - > Call->インターネット通話設定 - > Accounts->は次のコードで活動してAndroidプログラミングによるSIPアカウントの作成

私が作成したアカウントを追加:

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(); 
    } 

しかしアカウントアプリケーションにバインドされ、アプリケーションを削除すると、そのアカウントが削除されます。私はそれをアプリケーションから独立させたい。

+1

ヨ 'Service'にそのコードを入れて、あなたの' Activity' – Tofasio

答えて

2

システムサイプセッティングのアクティビティを開始し、システムをナビゲートする必要はありませんが、システムにアカウントを追加できます。

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); } 
+0

は、あなたがたとえば、あなた自身のSIPアプリを書いている場合は助けにはならない、と入力した資格情報を(必要になりますからサービスを管理することができますパスワードを含む)を使用して、後で自分のSIPスタック経由でアカウントを手動で登録します。 – EntangledLoops

関連する問題