Friday 19 March 2021

Notification.permission in Xamarin Webview

I am quite new to Xamarin App Development. I have a web application using FirebaseNotifications. In the webapp I use this javascript code for checking whether notficatons are accepted.

 if (Notification.permission !== "granted") {
            Notification.requestPermission();
        }

This works pretty well, I can then receive notifications using

firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();

messaging.onMessage(function (payload) {
   //do something
}

BUT, when I call the same website in an XamarinForms WebView, I get an exception, that Notificaton is null. Therefore I can not grant the the permission and not receive any messages.

Any idea?



from Notification.permission in Xamarin Webview

No comments:

Post a Comment