React-native-push-notification: am I required to configure the installation including firebase? Even though I'm only going to use local notification

Created on 26 May 2020  路  4Comments  路  Source: zo0r/react-native-push-notification

I'm just wanting to use local notification, no firebase, but every time I follow the installation process ignoring the parts, I make an error and crash the application asking for firebase.

  • react-native: 0.62.2
  • react-native-push-notification: latest

android/settings.gradle

...
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = file('../node_modules/react-native-push-notification/android')

android/app/src/main/AndroidManifest.xml

.....
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

    <application ....>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
                android:value="YOUR NOTIFICATION CHANNEL NAME"/>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
                    android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>

        <!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="false"/>
        <!-- Change the resource name to your App's accent color - or any other color you want -->
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
...

following error:
Screenshot_20200525-165117

Most helpful comment

Hi @t-heu
There is a comment in the readme (.configure) to avoid this issue:

  /**
   * (optional) default: true
   * - Specified if permissions (ios) and token (android and ios) will requested or not,
   * - if not, you must call PushNotificationsHandler.requestPermissions() later
   * - if you are not using remote notification or do not have Firebase installed, use this:
   *     requestPermissions: Platform.OS === 'ios'
   */
  requestPermissions: true,

All 4 comments

Hi @t-heu
There is a comment in the readme (.configure) to avoid this issue:

  /**
   * (optional) default: true
   * - Specified if permissions (ios) and token (android and ios) will requested or not,
   * - if not, you must call PushNotificationsHandler.requestPermissions() later
   * - if you are not using remote notification or do not have Firebase installed, use this:
   *     requestPermissions: Platform.OS === 'ios'
   */
  requestPermissions: true,

@Dallas62 can I just pass a false? because if i want to use ios, it will give true and it may end up giving this error again no?

This library doesn鈥檛 include iOS code, and iOS library behind use APN.
This error will not occur on iOS with this change 馃槈

thank you

Was this page helpful?
0 / 5 - 0 ratings