0
private static final String CALLACTION = "android.intent.action.PHONE_STATE";

然后我注册它

 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活动中

4

1 回答 1

0

看看教程

http://www.tutorialforandroid.com/2009/01/get-phone-state-when-someone-is-calling_22.html

它会解决你的问题

于 2012-08-29T14:50:56.713 回答