开发者

Small confusion about PhoneStateIntentReceiver

开发者 https://www.devze.com 2023-03-02 21:28 出处:网络
public class MyReceiver extends PhoneStateIntentReceiver { @Override public void onReceiveIntent(Context context, Intent intent) {
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

精彩评论

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