I want to bring my app to front of phone call answer screen when i receive a call. I did every coding part to happen after receiving a call. But the app is not coming to front. Its just open and stays below the phone call answer screen.
I want to bring my app to front of this screen.
I did something like below:
Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
ComponentName cn = new ComponentName(this, MainActivity.class);
i.setComponent(cn);
startActivity(i);
But there is no change.
You need to Implement one service to invoke application from background.
Now start service when your app detects call is received.
Add the priority to the receiver..this will help to be called prior than the native incoming call by the android os
Hope this would be helpfull