My app listens for an Intent fired by a third party app when an Activity in that app is shown. The Intent is received in a BroadcastReceiver in my app. I want to start an Activity from the BroadcastReceiver which will show as a Dialog over the existing activity (that fired the Intent).
@Override
public void onReceive(final Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, ">>>>>>>>> Action:" + action);
if ("clover.intent.action.V1_ORDER_BUILD_START".equals(action)) {
Intent i = new Intent(context.getApplicationContext(), ActiveOrderActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
The Intent clover.intent.action.V1_ORDER_BUILD_START is fired by a different app which my app listens for. When this Intent is fired, an Activity is already open (see the background activity in the picture below).
Now I want to show an Activity in my app as Dialog over the already shown activity, just like the "Add Customer to Order" in the image below.
As shown in the code above, I am starting an Activity from BroadcastReceiver, but when it starts, it comes to foreground and the previous Activity is not shown.
See below for an example of what I want to achieve,
