Tapping Push Notification on Android recreates app instead of resuming

I'm trying to figure out if this is the expected behavior or not.

I've got a Forms app with the OneSignal SDK installed for Push Notifications. I receive the notifications correctly on my Galaxy S7 while the app is open or in the background. When I tap the notification, the MainActivity in the application is created again, then my App constructor is run and my whole application is initialized a second time. If I hit the back button, I get dropped back to the previous Activity in the app that was already running.

Is the expected behavior of tapping a Push Notification on Android to open a new instance of your App? I would have thought it would just resume the instance that is already running.


Best Answer


  • rhino-coreyrhino-corey USMember ✭✭

    @AdamMeaney said:
    You want to set the launch mode to SingleTop I believe and handle the notification in OnNewIntent, then get it to your Forms side somehow.

    That totally worked! Thanks Adam. I have the handler code already, but I didn't think to use the OnNewIntent, so I'll try that.

  • NickKovalskyNickKovalsky USMember ✭✭✭

    Just add LaunchMode = LaunchMode.SingleTask to your MainActivity

  • JohnHardmanJohnHardman GBUniversity mod
    edited March 2019

    It's an old thread, but I found that on versions of Android that support split-screen mode, SingleTask does what I want (as per @NickKovalsky ), whereas SingleTop gave me what seemed to be multiple views onto the same app. Of course, it may be that others have slightly different requirements for which SingleTop is more appropriate, even on newer Android versions.

Sign In or Register to comment.