phonecalls - Get call receive event in android -


can incoming call pick , end call event in android through coding? want when received incoming call should show toast message. incoming call want when end call should show toast message in app.please suggest me.

if want when application's 1 activity use following code :

phonestatelistener phonestatelistener = new phonestatelistener() {         @override         public void oncallstatechanged(int state, string incomingnumber) {              if (state == telephonymanager.call_state_ringing) {                 // incoming call: pause music                 log.i("phone", "ringing");              } else if (state == telephonymanager.call_state_idle) {                   log.i("phone", "idle");             } else if (state == telephonymanager.call_state_offhook) {                 // call dialing, active or on hold                 log.i("phone", "offhook");              }             super.oncallstatechanged(state, incomingnumber);         }     }; 

or if want show toast eve outside of application try make service.

there nice tutorials on service available.

first read this on developer.

and tutorial.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -