react-native-android-whitelist
    TypeScript icon, indicating that this package has built-in type declarations

    0.4.0 • Public • Published

    react-native-android-whitelist

    Many android manufactuers have power saving optimizations that prevents applications from receiving push notifications while the app is not active. This package will help you alert the user to whitelist your app so that push notifications will arrive more reliably. To learn more about this problem, please visit https://dontkillmyapp.com/

    Supported Manufacturers:

    Manufacturer Power Saving Feature
    Asus Auto-Start Manager
    MIUI Auto-Start Manager
    Letv Auto-Boot Manager
    Huawei Protected Apps
    Coloros Startup App List
    Oppo Startup App
    Vivo Background Startup Manager
    Samsung Battery Activity

    screenshot

    Getting started

    $ npm install react-native-android-whitelist --save

    React Native versions < 0.60

    Please use this the reverse-jetify functionality of the following library to convert back from AndroidX: https://github.com/mikehardy/jetifier

    Automatic installation

    $ react-native link react-native-android-whitelist

    Manual installation

    Android

    1. Open up android/app/src/main/java/[...]/MainActivity.java
    • Add import co.reclub.android.whitelist.RNAndroidWhitelistPackage; to the imports at the top of the file
    • Add new RNAndroidWhitelistPackage() to the list returned by the getPackages() method
    1. Append the following lines to android/settings.gradle:
      include ':react-native-android-whitelist'
      project(':react-native-android-whitelist').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-whitelist/android')
      
    2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      implementation project(':react-native-android-whitelist')
      

    Usage

    import AndroidWhitelist from 'react-native-android-whitelist';
    
    const config = {
      title: 'Android Whitelist',
      text: 'To ensure timely delivery of push notifications, please whitelist our app.',
      doNotShowAgainText: 'Do not show again',
      positiveText: 'Whitelist',
      negativeText: 'Cancel'
    }
    
    AndroidWhitelist.alert(config)

    Install

    npm i react-native-android-whitelist

    DownloadsWeekly Downloads

    15

    Version

    0.4.0

    License

    MIT

    Unpacked Size

    75.5 kB

    Total Files

    17

    Last publish

    Collaborators

    • t0nyh0