开发者

Small confusion about PhoneStateIntentReceiver

public class MyReceiver extends PhoneStateIntentReceiver {        
  @Override        
  public void onReceiveIntent(Context context, Intent intent) {  
    if (intent.action == Intent.CALL_ACTION) {         

    }
  }
}

Assume that notifyPhoneCallState has been called to enable MyReceiver to receive notifications about phone call states, in which case the code will get executed?

  • when device receives an incoming call
  • when outgoing call is initiated on the device
  • when the user presses the call button
  • incoming phone call is terminated
  • or will the code not be execute开发者_如何学编程d at all?


Did you mean public static final String ACTION_CALL instead of CALL_ACTION?

Activity Action: Perform a call to someone specified by the data.

Input: If nothing, an empty dialer is started; else getData() is URI of a phone number to be dialed or a tel: URI of an explicit phone number.

Output: nothing.

Note: there will be restrictions on which applications can initiate a call; most applications should use the ACTION_DIAL.

Note: this Intent cannot be used to call emergency numbers. Applications can dial emergency numbers using ACTION_DIAL, however.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜