My program consists of one service and two actvities: "Main" and a "Alert" activity which I use to show alerts when something happens in the background, doesn't matter if the main activity is running or not.
The desired behaviour, which is the one I get with my HTC One M7 (Android 5) is:
(1)The service detects a condition where the "alert" activity has to be launched.
(2)Generates an intent for that activity
(3)the alert activity is launched regardless the "Main" state. (if Main was running, it gets paused)
(4)When I close alert activity, everything is ok (and Main is Resumed if it was previously running)
But with other phones (Galaxy S3 with Android 4.1.X and BQ Aquaris with Android 4.4.2) , I see strange things:
(3) only works when main has been explicitly finished. If it is running or even paused, the second activity will not be launched.
I have a very ugly workaround for this, that is: when Main activity is paused, I always finish it, and when it is running, the alert activity is launched from the same Main (then it works)
Any solution to avoid this workaround?
The desired behaviour, which is the one I get with my HTC One M7 (Android 5) is:
(1)The service detects a condition where the "alert" activity has to be launched.
(2)Generates an intent for that activity
(3)the alert activity is launched regardless the "Main" state. (if Main was running, it gets paused)
(4)When I close alert activity, everything is ok (and Main is Resumed if it was previously running)
But with other phones (Galaxy S3 with Android 4.1.X and BQ Aquaris with Android 4.4.2) , I see strange things:
(3) only works when main has been explicitly finished. If it is running or even paused, the second activity will not be launched.
I have a very ugly workaround for this, that is: when Main activity is paused, I always finish it, and when it is running, the alert activity is launched from the same Main (then it works)
Any solution to avoid this workaround?