title: Sip Manager shows null
body: <p>I am trying to build a sip application on android LGP500. It has android version 2.3.3. I have used brekeke sip server. Also android.net.sip is present in android.jar. This shows google services has been installed correctly. Even zoiper is working on that phone, so I dont think there are issues on the voip or sip server. Still it is showing SipManager as null. Please help.</p>
  
  <p>Code:</p>
  
  <h2>MainActivity:</h2>
  
  <pre><code>    package com.example.ssiipp;
  
  import android.net.ParseException;
  import android.net.sip.SipAudioCall;
  import android.net.sip.SipException;
  import android.net.sip.SipManager;
  import android.net.sip.SipProfile;
  import android.net.sip.SipRegistrationListener;
  import android.os.Bundle;
  import android.app.Activity;
  import android.app.PendingIntent;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.view.Menu;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.View.OnTouchListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ToggleButton;
  import java.lang.*;
  
  public class MainActivity extends Activity implements View.OnTouchListener {
  
      public String sipAddress = null;
      public SipManager manager = null;
      public SipProfile me = null;
      public SipAudioCall call = null;
      //public IncomingCallReceiver callReceiver;
  
      private static final int CALL_ADDRESS = 1;
      private static final int SET_AUTH_INFO = 2;
      private static final int UPDATE_SETTINGS_DIALOG = 3;
      private static final int HANG_UP = 4;
      static EditText et1;
      EditText et2;
      static EditText et3;
      Button b1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          et1 = (EditText) findViewById(R.id.et);
          et2 = (EditText) findViewById(R.id.ett);
          et3 = (EditText) findViewById(R.id.ee);
          b1 = (Button) findViewById(R.id.btn);
          manager = SipManager.newInstance(this);
          initializeManager();
          et3.setText("1");
  
          try {
              ToggleButton pushToTalkButton = (ToggleButton) findViewById(R.id.tb);
              pushToTalkButton.setOnTouchListener(this);
              IntentFilter filter = new IntentFilter();
              filter.addAction("com.example.ssiipp.SIP_INCOMING_CALL");
              //et3.setText("11");
              //callReceiver = new IncomingCallReceiver();
  
              //what is sticky intent?
              //   this.registerReceiver(callReceiver, filter);
          } catch (Exception e) {
              et1.setText("ERROR" + e.getMessage());
          }
          //Context ct=getBaseContext();
  
          b1.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  sipAddress = et2.getText().toString();
                  initiateCall();
              }
          });
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      public void onStart() {
          super.onStart();
          // When we get back from the preference setting Activity, assume
          // settings have changed, and re-login with new auth info.
          //initializeManager();
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
          if (call != null) {
              call.close();
          }
  
          closeLocalProfile();
  
  
      }
  
      public void initializeManager() {
  
          if (manager == null) {
              manager = SipManager.newInstance(this);
              et1.setText("MNGR=" + manager);
          }
  
          initializeLocalProfile();
      }
  
      public void closeLocalProfile() {
          if (manager == null) {
              return;
          }
          try {
              if (me != null) {
                  manager.close(me.getUriString());
              }
          } catch (Exception ee) {
              // Log.d("WalkieTalkieActivity/onDestroy", "Failed to close local profile.", ee);
          }
      }
  
      public void initializeLocalProfile() {
          if (manager == null) {
              //et1.setText("no");
              return;
          }
  
          if (me != null) {
              closeLocalProfile();
          }
  
          String username = "1010";
          String domain = "192.168.3.12";
          String password = "1010";
  
          try {
              SipProfile.Builder builder = new SipProfile.Builder(username, domain);
              builder.setPassword(password);
              builder.setPort(5060);
  
              me = builder.build();
  
              Intent i = new Intent();
              i.setAction("com.example.ssiipp.INCOMING_CALL");
              PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, Intent.FILL_IN_DATA);
              manager.open(me, pi, null);
  
  
              // This listener must be added AFTER manager.open is called,
              // Otherwise the methods aren't guaranteed to fire.
              manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {
                  public void onRegistering(String localProfileUri) {
                      et1.setText("Yes Registering with SIP Server...");
                  }
  
                  public void onRegistrationDone(String localProfileUri, long expiryTime) {
                      et1.setText("Ready");
                  }
  
                  public void onRegistrationFailed(String localProfileUri, int errorCode,
                      String errorMessage) {
                      et1.setText(me.getPassword() + me.getPort() + me.getUriString() + "Registration failed.  Please check settings.");
                  }
              });
          } catch (ParseException pe) {
              et1.setText("Connection Error.1");
          } catch (SipException se) {
              et1.setText("Connection error.2");
          } catch (java.text.ParseException e) {
              e.printStackTrace();
              et1.setText("Connection error.3");
          }
  
      }
  
      public void initiateCall() {
  
          et1.setText(sipAddress);
  
          try {
              et1.setText("in");
              SipAudioCall.Listener listener = new SipAudioCall.Listener() {
                  // Much of the client's interaction with the SIP Stack will
                  // happen via listeners.  Even making an outgoing call, don't
                  // forget to set up a listener to set things up once the call is established.
                  @Override
                  public void onCalling(SipAudioCall call) {
                      et1.setText("calling");
                  }
  
                  @Override
                  public void onCallEstablished(SipAudioCall call) {
                      et1.setText("call1");
                      call.startAudio();
                      call.setSpeakerMode(true);
                      call.toggleMute();
                      et1.setText("call");
                  }
  
                  @Override
                  public void onCallEnded(SipAudioCall call) {
                      et1.setText("Ready.");
                  }
              };
  
              call = manager.makeAudioCall(me.getUriString(), et2.getText().toString(), listener, 30);
              // call = manager.makeAudioCall(me.getUriString(), (""+et2.getText()).trim(),   null, 200);
              // et1.setText(""+call.getPeerProfile());
          } catch (Exception e) {
              et1.setText("WalkieTalkieActivity/InitiateCall" + e.getMessage());
  
          }
      }
  
      @Override
      public boolean onTouch(View v, MotionEvent event) {
          // TODO Auto-generated method stub
          return false;
      }
      public static void pass(String str) {
          et3.setText(str);
      }
  
  }
  </code></pre>
  
  <h2>Manifest:</h2>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.ssiipp" android:versionCode="1" android:versionName="1.0"&gt;
    &lt;uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/&gt;
    &lt;uses-permission android:name="android.permission.USE_SIP"/&gt;
    &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
    &lt;uses-permission android:name="android.permission.VIBRATE"/&gt;
    &lt;uses-permission android:name="android.permission.CONFIGURE_SIP"/&gt;
    &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
    &lt;uses-permission android:name="android.permission.WAKE_LOCK"/&gt;
    &lt;uses-permission android:name="android.permission.RECORD_AUDIO"/&gt;
    &lt;uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/&gt;
    &lt;uses-feature android:name="android.software.sip" android:required="true"/&gt;
    &lt;uses-feature android:name="android.software.sip.voip" android:required="true"/&gt;
    &lt;uses-feature android:name="android.hardware.telephony" android:required="false"/&gt;
    &lt;uses-feature android:name="android.hardware.sip.voip" android:required="true"/&gt;
    &lt;uses-feature android:name="android.hardware.wifi" android:required="true"/&gt;
    &lt;uses-feature android:name="android.hardware.microphone" android:required="true"/&gt;
    &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"&gt;
      &lt;activity android:name="com.example.ssiipp.MainActivity" android:label="@string/app_name"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN"/&gt;
          &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
        &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;receiver android:name=".IncomingCallReceiver" android:label="Call Receiver"/&gt;
      &lt;intent-filter&gt;
        &lt;action android:name="android.SipDemo.INCOMING_CALL"/&gt;
      &lt;/intent-filter&gt;
    &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>log file:</p>
  
  <pre><code>05-03 16:06:53.539: I/ActivityManager(1568): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.ssiipp/.MainActivity } from pid 12990
  05-03 16:06:53.659: D/KeyguardViewMediator(1568): &lt;!&gt;com.android.internal.policy.impl.KeyguardViewMediator 608&lt;!&gt; wakeWhenReadyLocked(3)
  05-03 16:06:53.799: D/DATA(1670): &lt;!&gt;com.android.internal.telephony.DataServiceStateTracker 1075&lt;!&gt; [DSST] pollstate() : reason = data network state changed
  05-03 16:06:53.809: D/[brighthy_log](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 606&lt;!&gt; [CHOSH] ONS plmn :null
  05-03 16:06:53.829: D/[brighthy_log](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 608&lt;!&gt; [CHOSH][TIM BR] plmn from getOperatorAlphaLong:Vodafone IN
  05-03 16:06:53.829: I/AMIT1(1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 802&lt;!&gt; SPN -2nd Block
  05-03 16:06:53.829: D/AMITKUMAR[2nd Block](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 803&lt;!&gt; currentLanguage: encurrentcountry: IN
  05-03 16:06:53.839: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 359&lt;!&gt; android.intent.action.SCREEN_ON
  05-03 16:06:53.839: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 360&lt;!&gt; Screen On!, try to request
  05-03 16:06:53.849: I/AMITKUMAR[3rd Block](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 872&lt;!&gt; SPN -3nd Block
  05-03 16:06:53.859: D/AMITKUMAR[3rd Block](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 874&lt;!&gt; operator: 40486
  05-03 16:06:53.859: D/AMITKUMAR[3rd Block](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 879&lt;!&gt; mcc: 404
  05-03 16:06:53.859: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 169&lt;!&gt; sCalendarMap, containsKey appWidgetId : 1 is exist in map
  05-03 16:06:53.859: D/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.CalendarWidgetProvider 313&lt;!&gt; Provider buildUpdate
  05-03 16:06:53.859: D/hs(11044): &lt;!&gt;com.lge.android._.LgeAndyFlex 28&lt;!&gt; opCode: [OPEN]
  05-03 16:06:53.869: D/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.view.MonthCalendarView 185&lt;!&gt; FirstDayTime1
  05-03 16:06:53.869: D/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.view.MonthCalendarView 200&lt;!&gt; FirstWeekDayTime28
  05-03 16:06:53.869: D/AMITKUMAR[3rd Block](1670): &lt;!&gt;com.android.internal.telephony.gsm.GsmServiceStateTracker 880&lt;!&gt; mnc: 86
  05-03 16:06:53.869: D/DATA(1670): &lt;!&gt;com.android.internal.telephony.DataServiceStateTracker 381&lt;!&gt; **DATAServiceStateTracker***handlePollStateResult()**simNumeric==40486
  05-03 16:06:53.879: D/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.data.DayEvents 80&lt;!&gt; mStartJulianDay : 2456776mEndJulianDay : 2456817
  05-03 16:06:53.879: D/DATA(1670): &lt;!&gt;com.android.internal.telephony.DataServiceStateTracker 382&lt;!&gt; **DATAServiceStateTracker***handlePollStateResult()**operatorNumeric==40486
  05-03 16:06:53.879: D/DATA(1670): &lt;!&gt;com.android.internal.telephony.DataServiceStateTracker 389&lt;!&gt; **DATAServiceStateTracker***handlePollStateResult()**=equalsMnc===true
  05-03 16:06:53.879: D/DATA(1670): &lt;!&gt;com.android.internal.telephony.DataServiceStateTracker 1075&lt;!&gt; [DSST] Poll ServiceState done: oldSS=[1 home null null null  GPRS CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false] newSS=[1 home null null null  GPRS CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false]
  05-03 16:06:53.899: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:06:53.899: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:06:53.939: D/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.view.MonthCalendarView 259&lt;!&gt; buildMonthViewDate : May 2014
  05-03 16:06:55.129: E/MediaPlayerService(1462): [MediaPlayerService::Client::setDataSource]player type = 4
  05-03 16:06:55.159: E/MediaPlayerService(1462): [MediaPlayerService::Client::setDataSource]player type = 4
  05-03 16:06:55.219: I/#LGIME(1661): &lt;!&gt;com.jungle.android.utils.Glog 32&lt;!&gt; ### onFinishInput
  05-03 16:06:55.219: I/#LGIME(1661): &lt;!&gt;com.jungle.android.utils.Glog 32&lt;!&gt; #### onStartInput: restarting=false, fieldId=2131230721
  05-03 16:06:55.219: W/InputManagerService(1568): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40a1ea50
  05-03 16:06:55.519: W/AudioFlinger(1462): write blocked for 283 msecs, 718 delayed writes, thread 0xce08
  05-03 16:06:55.689: E/Andy_LockScreen(1568): &lt;!&gt;com.android.internal.policy.impl.Andy_LockScreen 1083&lt;!&gt; [BTUI] ### LockScreen : isOpen(false)
  05-03 16:06:59.889: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:06:59.889: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:00.029: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 321&lt;!&gt; android.intent.action.TIME_TICK
  05-03 16:07:02.899: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:02.899: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:07.479: I/ActivityManager(1568): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.ssiipp/.MainActivity } from pid 13025
  05-03 16:07:12.429: I/ActivityManager(1568): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.lge.launcher/.Launcher } from pid 1568
  05-03 16:07:12.939: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:12.939: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:24.949: I/ActivityManager(1568): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.ssiipp/.MainActivity } from pid 13056
  05-03 16:07:30.959: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:30.959: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:33.949: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:33.949: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:39.939: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:39.939: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:41.069: I/ActivityManager(1568): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.ssiipp/.MainActivity } from pid 13089
  05-03 16:07:41.269: I/#LGIME(1661): &lt;!&gt;com.jungle.android.utils.Glog 32&lt;!&gt; ### onFinishInput
  05-03 16:07:41.279: I/#LGIME(1661): &lt;!&gt;com.jungle.android.utils.Glog 32&lt;!&gt; #### onStartInput: restarting=false, fieldId=2131230721
  05-03 16:07:41.519: I/ActivityManager(1568): &lt;!&gt;com.android.server.am.ActivityRecord 444&lt;!&gt; Displayed com.example.ssiipp/.MainActivity: +401ms
  05-03 16:07:42.949: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:42.949: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:07:54.949: D/StatusBarPolicy(30405): [BRIGHTHY] 0. mDataNetType: 2
  05-03 16:07:54.949: D/StatusBarPolicy(30405): [BRIGHTHY] curNetwork=40486 curHPLMN=40486
  05-03 16:08:00.039: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 321&lt;!&gt; android.intent.action.TIME_TICK
  05-03 16:08:00.549: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 365&lt;!&gt; android.intent.action.SCREEN_OFF
  05-03 16:08:00.549: I/hs(11044): &lt;!&gt;com.lge.android.calendarwidget.widget.UpdateService 366&lt;!&gt; Screen Off!, sAppWidgetIds clearing..
  05-03 16:08:05.499: E/Andy_LockScreen(1568): &lt;!&gt;com.android.internal.policy.impl.Andy_LockScreen 1083&lt;!&gt; [BTUI] ### LockScreen : isOpen(true)
  </code></pre>
  
  <p>actually i got new problem: my lgp500 doesnot support voip and sip. Please tell me where to test my application. I also tried adb. But its not working. It shows:cannot connect. even the ping is unable to connect. Pls help.</p>