c# - Multiple messages from Xamarin Messaging center when application is restarted -


i have xamarin forms application in use messagingcenter send data specific platform xamarin.forms application.

in page subscribe messages in base.onappearing() , unsubscribe in base.ondisappearing() method. works expected.

the problem i'm having when application get's stopped androidos (example of when change language of device) start getting copies of messages. i'm confused why happening noticed base.ondisappearing() method not called when application restarted.

does have idea cause problem , how fix it? also, there way in xamarin see publishers , subscribers?

like greensy said, in addition subscribing in onappearing() , unsubscribing in ondisappearing(), unsubscribe message before subscribing because, why not:

protected override async void onappearing() {     base.onappearing();      messagingcenter.unsubscribe<string>(this, "keyhere");     messagingcenter.subscribe<string>(this, "keyhere", string => { })); } 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -