April 2018
Intermediate to advanced
284 pages
6h 43m
English
To allow your app to receive notifications in your browser, it will have to get permissions from the user. To do so, we will add a piece of code that will show a consent dialog to let the user grant your app permission to receive notifications in your browser.
We will add the componentWillMount() method to our index.jsx file present under the home directory, since we want to show the dialog once the user is successfully logged in to the app:
componentWillMount() { firebase.messaging().requestPermission() .then(function() { console.log('Permission granted.'); // you can write logic to get the registration token // _this.getToken(); }) .catch(function(err) { console.log('Unable to get permission to ...Read now
Unlock full access