I have a strange bug only producing on Android 10 while perfectly fine on Pie and Oreo. I am starting a call from Activity, when the call starts i want to minimize the call screen and get my activity back to foreground. My code to minimize call screen is below:
private void minimizeCallScreen(){
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//intent to bring my activity to foreground
Intent intent = new Intent(getApplicationContext(), MyActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}, 1000);
}
As soon as call starts, I call this method to minimize call screen, which is working perfectly fine on Oreo and Pie but on Android 10 it works only for the first time. It does not work when i start call 2nd time until i go back and recreate my activity. I have tried many different intent flags but nothing is working.
NOTE: This issue is Android 10 specific