When a user taps on a Remote Notification while the App is in the background I want the App to be foregrounded to wherever the user last left it: assuming the app has not been killed by the OS in which case I want it to start with the LAUNCHER Activity.
Is this possible?
Currently when I tap on a notification it always starts with my LAUNCHER Activity regardless of whether I backgrounded the app while on a different Activity.
UPDATE
So I created an Activity specifically for handling the click_action in my notification:
public class NotificationHandlerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finish();
}
}
Then in my Manifest:
<activity android:name="com.testing.NotificationHandlerActivity" android:screenOrientation="portrait" >
<intent-filter>
<action android:name="myAction" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Finally when I send the notification I set the click action:
click_action="myAction"
So this works well. When the app is background and I tap on the notification it appears like I'm taken back to where I left off; which is what I want.
The problem now is that when the app is swiped away clicking on the notification does not do anything: since the Activity goes away and there is nothing underneath it.
So the question is: is this a good approach? If so, how could I get around the issue of tapping on a notification when the app is not running in the background?