I am trying to show the user information on Incoming Call screen, whenever there is an Incoming Call. So i have a Broadcast Receiver listening to Incoming calls, which starts the Intent Service, which subsequently starts an Activity (with Theme Dialog) .
Now Whenever there is an Incoming Call , My Activity Dialog Pops Up and Shows as Intended.
Problem : When the Activity Dialog is already on the Screen and Incoming call comes, there is no new Activity Dialog with new Information. I guess that whenever there is an Instance , android does not creates the new one. So it seems like my problem is "Creating Multiple Instances of an Activity".
Please note that i am starting an Activity from an Intent Service using FLAG_NEW_TASK.
Android does create multiple instances of the activity unless you specify the FLAG_ACTIVITY_CLEAR_TOP option. Quoting the documentation for this option.
If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.
If you need to receive the new intents on this activity when the clear_top flag is set, override the onNewIntent() method.
Although i can receive the new Intent via overriding the onNewIntent() method, how would i end up having multiple instances of an activity dialog.
When an activity is launched, the android framework creates a stacked history of activities. This is used to allow the user to press the back button and go back to a previous activity. If you do not want this behavior use the FLAG_ACTIVITY_CLEAR_TOP option.
Using FLAG_NEW_TASK will make your activity the first on the history stack. I'm not sure that is what you want.