简体   繁体   中英

How can I display an option screen when a user disconnects a call?

How can I display an option screen when a user disconnects a call?

在此处输入图片说明

Check PhoneStateListener here

http://developer.android.com/reference/android/telephony/PhoneStateListener.html

You may also try these tutorials:

http://www.botskool.com/geeks/how-listen-phone-events-android

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

Just log all state changes to check what state is being triggered when you hangup.

Hope that helps. :)

It detects hangup button key events.

  @Override
  public boolean dispatchKeyEvent(KeyEvent event) {
  int keyCode = event.getKeyCode();
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
     if (keyCode == KeyEvent.KEYCODE_ENDCALL) {
        //do your work here
        return true;
     } else {
        return super.dispatchKeyEvent(event);
     }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM