サービスで発信呼び出しをキャッチしようとしていますが、今ではデバッガーコンソールで何かを期待しています。
DailerReceiver
(マニフェストに追加され、 を拡張する)を作成しますBroadcastReceiver
。IntentFilter
次に、 withを追加し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 #####################