0
private static final String CALLACTION = "android.intent.action.PHONE_STATE";
然後我註冊它如何檢查收到的意向操作是NEW_OUTGOING_CALL,NEW_INCOMING_CALL還是掛斷?
final IntentFilter theCallFilter = new IntentFilter();
theCallFilter.addAction(CALLACTION);
yourCallReceiver = new CallReceiver();
// Registers the receiver so that your service will listen for broadcasts
registerReceiver(yourCallReceiver, theCallFilter);
,後來我用
if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) { ... }
檢查,但我也檢查,如果是
android.intent.action.NEW_OUTGOING_CALL
或來電,或者是掛向上...?如果是如何PHONE_STATE
活動中