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.