Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking the notification resets ViewModel variables #44

Open
ouijahija opened this issue Aug 13, 2018 · 0 comments
Open

Clicking the notification resets ViewModel variables #44

ouijahija opened this issue Aug 13, 2018 · 0 comments

Comments

@ouijahija
Copy link

ouijahija commented Aug 13, 2018

Bug

Plugin Version: 3.0.1
Platform: Xamarin.Forms 3.1.0.697729
Device/Hardware: Moto Z(2) Force

Expected behavior

The App resumes when clicking the notification.

Actual behavior

The App opens and seems to be reseted (Variables of ViewModels are set back to default). Some variables from other plugins (e.g. Plugins.BluetoothLE from aritchie) are not reseted.
I suspect, that the error #10 stems from the same bug (Because the inconsistent variables lead to a faulty application logic)

Steps to reproduce the behavior

  • Create a Xamarin.Forms.Android Project with Masterdetail
  • Create a ContentPage with the following methods:
protected override void OnAppearing()
{
          base.OnAppearing();
          MessagingCenter.Unsubscribe<App>(this, App.ON_SLEEP_KEY_VALUE);
          CrossLocalNotifications.Current.Cancel(101);
}

protected override void OnDisappearing()
{
          base.OnDisappearing();

          MessagingCenter.Subscribe<App>(this, App.ON_SLEEP_KEY_VALUE, app =>
          {
                    //viewModel.DisposeScan();
                    CrossLocalNotifications.Current.Show("App", "App is currently running in Background.", 101);     
           });
}

and add this to your App class

public const string ON_SLEEP_KEY_VALUE = "SpecialOnSleepKeyValue";

protected override void OnSleep ()
{
       MessagingCenter.Send(this, ON_SLEEP_KEY_VALUE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant