Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native push notification for local notification without firebase not possible

React Native project with push notifications, I use this.

I follow this tutorial.

I only need local notifications. But if I run this project I get an error default firebaseapp is not initialized in this process.

I follow this answer and get a google service.json from firebase to make it start (notification don't show up unfortunately). But is this also possible without firebase?

like image 204
Harold Avatar asked Sep 17 '25 12:09

Harold


2 Answers

requestPermissions: Platform.OS === 'ios', This line you have to add 
import { Platform} from 'react-native';    
PushNotification.configure({
    
      onRegister: function (token) {
        console.log("TOKEN:", token);
      },

      onNotification: function (notification) {
        console.log("NOTIFICATION:", notification);


      },

      permissions: {
        alert: true,
        badge: true,
        sound: true,
      },


      popInitialNotification: true,
      requestPermissions: Platform.OS === 'ios',// This line you have to add //import Platform from react native
    });
like image 83
Rajan rek Avatar answered Sep 19 '25 04:09

Rajan rek


Yes, it is possible to push local notification without firebase. I implemented it in one of my projects. You can take reference from this comment.

And also you don't have to call register methods from example which is available in react-native-push-notifications repo.

PS: As author did not marked any of the above answers as resolved. I hope this will work.

like image 38
Dexter Avatar answered Sep 19 '25 03:09

Dexter