I'm working on a home replacement app for people with eyesight problems. I don't want users to leave the call screen during a call by mistake.
I'm trying to bring the screen to front programatically if the user accidentally went back to my launcher during a call, but I haven't been able to figure how to do it. This is what I'm trying right now:
@Override
public void onResume() {
// If call state offhook, go back to current call
TelephonyManager telephony = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
if (telephony.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK) {
Intent i = new Intent(Intent.ACTION_DIAL, null);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
getApplicationContext().startActivity(i);
}
How can I bring the call screen to front?