Posts

Showing posts with the label service

how can i start a service while on call in android

how can i start a service while on call in android public class CustomPhoneStateListener extends PhoneStateListener { //private static final String TAG = "PhoneStateChanged"; Context context; //Context to make Toast if required public CustomPhoneStateListener(Context context) { super(); this.context = context; } @Override public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state, incomingNumber); switch (state) { case TelephonyManager.CALL_STATE_IDLE: //when Idle i.e no call Toast.makeText(context, "Phone state Idle", Toast.LENGTH_LONG).show(); break; case TelephonyManager.CALL_STATE_OFFHOOK: //when Off hook i.e in call //Make intent and start your service here Intent intent= new Intent(); break; case TelephonyManager.CALL...