title: Catching outgoing calls in a service
body: <p>I am trying to catch an outgoing call in a service and by now I would expect something in the debugger console.</p>
  
  <p>I create a <code>DailerReceiver</code> (who is added in the manifest and extends the <code>BroadcastReceiver</code>). Then I add an <code>IntentFilter</code> with <code>android.intent.action.NEW_OUT_GOING_CALL</code> and register the receiver. Also I enable the service in the manifest. I expect those are the required steps.</p>
  
  <p>There is also some more information in the manifest. I'm unsure whether that is really necessary but added it in the example to get the whole picture. </p>
  
  <p>Piece of the service:</p>
  
  <pre><code>public class BackgroundService extends Service {
  
      @Override
      public void onCreate() {
          DialerReceiver mReceiver = new DialerReceiver();
          IntentFilter filter = new IntentFilter();
          filter.addAction("android.intent.action.NEW_OUTGOING_CALL");
          this.registerReceiver(mReceiver, filter);
      }
  }
  </code></pre>
  
  <p>Class <code>DialerReceiver</code>:</p>
  
  <pre><code>public class DialerReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context arg0, Intent arg1) {
          // TODO Auto-generated method stub
          debugOut("arg0: " + arg0.toString());
          debugOut("arg1: " + arg1.toString());
          debugOut("isOrderedBroadcast = " + isOrderedBroadcast());
      }
  
      private static void debugOut(String str) {
          Log.d("DialerReceiver", str);
      }
  }
  </code></pre>
  
  <p>Part of the manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /&gt;
  
  &lt;receiver 
      android:name=".DialerReceiver"
      android:enabled="true"&gt;
      &lt;intent-filter android:priority="2147483647"&gt;
          &lt;action android:name="android.intent.action.NEW_OUTGOING_CALL"/&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  
  &lt;service
      android:name=".BackgroundService"
      android:enabled="true"&gt;            
      &lt;intent-filer&gt;
          &lt;action android:name="android.intent.action.NEW_OUTGOING_CALL"/&gt;                
      &lt;/intent-filer&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>Full error log from the minute a test call took place:</p>
  
  <pre><code>03-14 09:28:32.095: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState0
  03-14 09:28:32.095: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState0
  03-14 09:28:32.140: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState0
  03-14 09:28:32.140: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState0
  03-14 09:28:32.370: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState36
  03-14 09:28:32.370: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState36
  03-14 09:28:32.420: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState32
  03-14 09:28:32.420: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState32
  03-14 09:28:32.880: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState779
  03-14 09:28:32.880: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState779
  03-14 09:28:33.065: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState779
  03-14 09:28:33.065: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState779
  03-14 09:28:33.730: E/SpannableStringBuilder(31997): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
  03-14 09:28:33.730: E/SpannableStringBuilder(31997): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
  03-14 09:28:35.195: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState5
  03-14 09:28:35.195: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState5
  03-14 09:28:35.300: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState154
  03-14 09:28:35.300: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState154
  03-14 09:28:35.405: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState154
  03-14 09:28:35.405: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState154
  03-14 09:28:35.530: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState154
  03-14 09:28:35.530: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState154
  03-14 09:28:35.620: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState37
  03-14 09:28:35.620: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState37
  03-14 09:28:35.765: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState37
  03-14 09:28:35.765: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState37
  03-14 09:28:35.850: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState7
  03-14 09:28:35.855: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState7
  03-14 09:28:35.995: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState7
  03-14 09:28:35.995: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState7
  03-14 09:28:36.050: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState7
  03-14 09:28:36.050: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState7
  03-14 09:28:37.735: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount before onRestoreInstanceState5
  03-14 09:28:37.735: E/TwAdapterView(31997): TwAdapterView AdapterDataSetObserver onChanged ItemCount after onRestoreInstanceState5
  03-14 09:28:37.775: E/SpannableStringBuilder(31997): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
  03-14 09:28:37.775: E/SpannableStringBuilder(31997): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
  03-14 09:28:39.155: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=DIALING, mBCall=IDLE, mRCall=IDLE, mCallsetup=0, mCall=0, mCallheld=0
  03-14 09:28:39.155: E/Bluetooth HS/HF(2853): audioOn()
  03-14 09:28:39.155: E/Bluetooth HS/HF(2853): audioOn(): headset is not connected!
  03-14 09:28:39.170: E/TinyUCM(1921): There aren't inputs in map or set stereo(0)
  03-14 09:28:39.170: E/TinyUCM(1921): Stereo is already enabled
  03-14 09:28:39.170: E/TinyUCM(1921): modifier doesn't exists any more
  03-14 09:28:39.205: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=DIALING, mBCall=IDLE, mRCall=IDLE, mCallsetup=2, mCall=0, mCallheld=0
  03-14 09:28:39.205: E/Bluetooth HS/HF(2853): audioOn()
  03-14 09:28:39.205: E/Bluetooth HS/HF(2853): audioOn(): headset is not connected!
  03-14 09:28:39.390: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=DIALING, mBCall=IDLE, mRCall=IDLE, mCallsetup=2, mCall=0, mCallheld=0
  03-14 09:28:39.390: E/Bluetooth HS/HF(2853): audioOn()
  03-14 09:28:39.390: E/Bluetooth HS/HF(2853): audioOn(): headset is not connected!
  03-14 09:28:39.435: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=DIALING, mBCall=IDLE, mRCall=IDLE, mCallsetup=2, mCall=0, mCallheld=0
  03-14 09:28:39.435: E/Bluetooth HS/HF(2853): audioOn()
  03-14 09:28:39.435: E/Bluetooth HS/HF(2853): audioOn(): headset is not connected!
  03-14 09:28:41.820: E/TinyUCM(1921): modifier doesn't exists any more
  03-14 09:28:42.920: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=ALERTING, mBCall=IDLE, mRCall=IDLE, mCallsetup=2, mCall=0, mCallheld=0
  03-14 09:28:44.300: E/TinyUCM(1921): There aren't inputs in map or set stereo(2100000)
  03-14 09:28:44.300: E/TinyUCM(1921): Stereo is already enabled
  03-14 09:28:44.300: E/TinyUCM(1921): modifier doesn't exists any more
  03-14 09:28:45.205: E/Watchdog(2277): !@Sync 1113
  03-14 09:28:46.555: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=ACTIVE, mBCall=IDLE, mRCall=IDLE, mCallsetup=3, mCall=0, mCallheld=0
  03-14 09:28:46.555: E/Bluetooth HS/HF(2853): audioOn()
  03-14 09:28:46.555: E/Bluetooth HS/HF(2853): audioOn(): headset is not connected!
  03-14 09:28:50.105: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=OFFHOOK, mFCall=DISCONNECTING, mBCall=IDLE, mRCall=IDLE, mCallsetup=0, mCall=1, mCallheld=0
  03-14 09:28:50.555: E/Bluetooth HS/HF(2853): audioOff(): mPendingScoForA2dp: false, mPendingScoForWbs: false, mConnectedSco: null, mA2dpState: 11, mA2dpSuspended: false, mVoiceRecognitionStarted: false
  03-14 09:28:50.605: E/TinyUCM(1921): modifier doesn't exists any more
  03-14 09:28:50.605: E/TinyUCM(1921): modifier doesn't exists any more
  03-14 09:28:50.605: E/TinyUCM(1921): Builtin Mic: active count 1
  03-14 09:28:50.605: E/TinyUCM(1921): Back Mic: active count 1
  03-14 09:28:50.605: E/TinyUCM(1921): modifier doesn't exists any more
  03-14 09:28:50.840: E/ActivityThread(2853): Failed to find provider info for com.cequint.ecid
  03-14 09:28:55.470: E/BargeInRecognizer(2853): stopBargeIn
  03-14 09:28:55.515: E/Bluetooth HS/HF(2853): handlePreciseCallStateChange() mPhone=IDLE, mFCall=IDLE, mBCall=IDLE, mRCall=IDLE, mCallsetup=0, mCall=0, mCallheld=0
  03-14 09:28:55.515: E/Bluetooth HS/HF(2853): audioOff(): mPendingScoForA2dp: false, mPendingScoForWbs: false, mConnectedSco: null, mA2dpState: 11, mA2dpSuspended: false, mVoiceRecognitionStarted: false
  03-14 09:28:55.900: E/WifiP2pStateTracker(2277): getNetworkInfo : NetworkInfo: type: WIFI_P2P[], state: UNKNOWN/IDLE, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
  03-14 09:28:58.175: E/WifiHW(2277): ##################### set firmware type 0 #####################
  03-14 09:28:58.385: E/WifiHW(2277): ##################### set firmware type 0 #####################
  </code></pre>