12

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.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82

1 Answers1

2

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); }
Totoo
  • 139
  • 11
  • 1
    Doesn't help if you're writing your own SIP app, for example, and will need the entered credentials (including password) to manually register the account afterwards via your own SIP stack. – EntangledLoops May 27 '16 at 16:21