push notification and reload the app (android platform)

My problem is : I use the home button to hide the application. When I get the notification and click it. My application will load the app again.
But it will create new instance even the app is hidden / sleep. But I just want it resume only!

In MainActivity.cs
`protected override void OnCreate(Bundle bundle)
{
instance = this;

        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

         base.OnCreate(bundle);        
         global::Xamarin.Forms.Forms.Init(this, bundle);

        if (Intent.Extras != null)
        {
            string msg = "";

            App.ClearIconMessageData();
            foreach (var key in Intent.Extras.KeySet())
            {
                var value = Intent.Extras.GetString(key);                    
                if (key != "google.sent_time Value" && string.IsNullOrEmpty(key) == false)
                {                  
                    App.ReceiveIconNotification(key, value);
                }
            }
        }         
        LoadApplication(new App());      
    }`

PCL:
App.xaml.cs
{
public static void ReceiveIconNotification(string key, string value)
{
//System.Diagnostics.Debug.WriteLine($"key: {key} , value: {value} ");
if (_iconMessageData == null)
{
_iconMessageData = new Dictionary<string, string>();
}

        _iconMessageData.Add(key, value);

    }

}

Tagged:
Sign In or Register to comment.