The intention to unregister was inherited from pre-existing design and not even sure if that was necessary.Īt any rate, the issue is why unregister didn't behave as expected. I am just curious why the unregister didn't work as expected, but I can move the registration in the AppShell page and forget all about it because AppShell is active throughout the app lifetime. Messages are sent as below from anywhere, and this works as expected. process the message sent via payLoad string Dictionary Public async void OnMessageReceived(object sender, Dictionary payLoad) ex.Message = "The target recipient has already subscribed to the target message." , string>(this, "MyMessagingCenterName", OnMessageReceived) Note: try-catch added to handle an exception that didn't exist under Xamarin MessagingCenter to display message from Push protected override async void OnAppearing() Here are snippets that register and unregister messaging handler on OnAppearing and OnDisappearing of a page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |