I am doing verification call from my app.Which should disconnect after 5-10 seconds which is configured.
Here is my code;
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + phoneNumber));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
handler.postDelayed(new Runnable() {
@Override
public void run() {
/*It is never called up untill call got disconnected/hanged up. */
Log.d(TAG, "Disconnecting :");
disconnectCall();
}
}, 5000);
startActivity(callIntent);
The problem is disconnectCall() method not called until callIntent activity is suspended i.e user forcefully disconnected call/hanged up. I need to parrelly invoke disconnectCall() during call activity.Not getting where is the problem in code.
You are calling startActivity(callIntent). This means you are transferring control to the caller app android. The call can now disconnected by android caller application when user wants.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With