Hi,
I use local notifications in my application. I want to open my background application from notification and show the message in popup window. That gives me exeption:
Android.Views.WindowManagerBadTokenException: 'Unable to add window -- token null is not valid; is your activity running?'
I think it is duo to timing but I doesn't know how to fix it.
//open popup after notification tapped
private static void ShowNotification(string title, string message)
{
App.isBackground = false;
Device.BeginInvokeOnMainThread(() =>
{
TelerikPopupWin.SetLabelText = title +"\n"+ message;
TelerikPopupWin.OpenPopup = true;
});
}
Error happens here:
public static bool OpenPopup { get { return popup.IsOpen; } set { popup.IsOpen = value; } }