我正在尝试在服务中捕获拨出电话,现在我希望调试器控制台中有一些东西。
我创建了一个DailerReceiver
(在清单中添加并扩展了BroadcastReceiver
)。然后我添加一个IntentFilter
并android.intent.action.NEW_OUT_GOING_CALL
注册接收器。我还在清单中启用了该服务。我希望这些是必需的步骤。
清单中还有更多信息。我不确定这是否真的有必要,但在示例中添加了它以获得整个画面。
服务部分:
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);
}
}
类DialerReceiver
:
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);
}
}
清单的一部分:
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<receiver
android:name=".DialerReceiver"
android:enabled="true">
<intent-filter android:priority="2147483647">
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>
<service
android:name=".BackgroundService"
android:enabled="true">
<intent-filer>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filer>
</service>
从发生测试呼叫的那一刻起的完整错误日志:
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 #####################