5.6.29 • Published 4 years ago

@i14/react-native-exact-notification v5.6.29

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
4 years ago

@i14/react-native-exact-notification

Getting started

$ npm install @i14/react-native-exact-notification --save

iOS

Refer to this docs: https://v5.rnfirebase.io/docs/v5.x.x/notifications/ios

Android

Install the RNFirebase Notifications package

Add the RNFirebaseNotificationsPackage to your android/app/src/main/java/com/app name/MainApplication.java:

import com.facebook.react.ReactApplication;
import com.reactlibrary.notifications.RNFirebaseNotificationsPackage;

public class MainApplication extends Application implements ReactApplication {
    // ...

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MyReactNativePackage());
      packages.add(new RNFirebaseNotificationsPackage()); // <-- Add this line
      return packages;
    }
  };
  // ...
}

Add the following to android/app/src/main/AndroidManifest.xml:

Add permissions:

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

Set app launch mode inside activity props:

<activity
  ...
  android:launchMode="singleTop"
>

Default icon and color (Optional) Within the application component, add metadata elements to set a default notification icon and color. Android uses these values whenever incoming messages do not explicitly set icon or color.

<application ...>
  <!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
       See README(https://goo.gl/l4GJaQ) for more. -->
  <meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_ic_notification" />
  <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
       notification message. See README(https://goo.gl/6BKBk7) for more. -->
  <meta-data
    android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/colorAccent" />
</application>

Notification channels From Android 8.0 (API level 26) and higher, notification channels are supported and recommended. FCM provides a default notification channel with basic settings. If you prefer to create and use your own default channel, set default_notification_channel_id to the ID of your notification channel object as shown; FCM will use this value whenever incoming messages do not explicitly set a notification channel.

<application ...>
  <meta-data
    android:name="com.google.firebase.messaging.default_notification_channel_id"
    android:value="@string/default_notification_channel_id"/>
</application>COPY

Scheduled Notifications You need to add the following to the application component of android/app/src/main/AndroidManifest.xml:

<application ...>
  <receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/>
  <receiver android:enabled="true" android:exported="true"  android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
    <intent-filter>
      <action android:name="android.intent.action.BOOT_COMPLETED"/>
      <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
      <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
      <action android:name="android.intent.action.TIMEZONE_CHANGED" />
      <action android:name="android.intent.action.TIME_SET" />
      <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
  </receiver>
</application>
5.6.29

4 years ago

5.6.28

4 years ago

5.6.27

4 years ago

5.6.26

4 years ago

5.6.25

4 years ago

5.6.24

4 years ago

5.6.23

4 years ago

5.6.22

4 years ago

5.6.20

4 years ago

5.6.18

4 years ago

5.6.17

4 years ago

5.6.21

4 years ago

5.6.16

4 years ago

5.6.15

4 years ago

5.6.14

4 years ago

5.6.13

4 years ago

5.6.12

4 years ago

5.6.11

4 years ago

5.6.10

4 years ago

5.6.9

4 years ago

5.6.8

4 years ago

5.6.7

4 years ago

5.6.6

4 years ago

5.6.5

4 years ago

5.6.4

4 years ago

5.6.3

4 years ago

5.6.2

4 years ago

5.6.1

4 years ago

5.6.0

4 years ago