Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-check-notification-enable

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-check-notification-enable

use to check is notification enable or disable only for android

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
446
decreased by-25.79%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-check-notification-enable

Check if notifications are enabled for a React Native app running on Android.

VersionReact Native SupportAndroid SupportiOS Support
1.2.00.609NONE
1.1.00.47-0.548.1NONE
1.0.40.468.1NONE

Complies with react-native-version-support-table

Installation

First you need to install react-native-check-notification-enable:

npm install react-native-check-notification-enable --save

If your React Native version is 0.60 or higher, that's all you need to do. If not, you'll need to perform the steps described below.

Android

Automatic installation

Run the following command:

react-native link react-native-check-notification-enable
Manual installation
  • In android/settings.gradle
...
include ':react-native-check-notification-enable', ':app'
project(':react-native-check-notification-enable').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-check-notification-enable/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-check-notification-enable')
}
  • register module (in MainActivity.java)

On newer versions of React Native (0.18+):

import com.skyward.NotificationManager.NotificationManager; // <--- import

public class MainActivity extends ReactActivity {
  ......

  /**
   * A list of packages used by the app. If the app uses additional views
   * or modules besides the default ones, add more packages here.
   */
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new NotificationManager() // <------ add here
        new MainReactPackage());
    }
}

iOS

Automatic installation

Run the following command:

react-native link react-native-check-notification-enable

Example

Load module

var NotificationManager = require('react-native-check-notification-enable');
// for es6
import NotificationManager from 'react-native-check-notification-enable'

Check notification is enable or not

// use as a promise...
NotificationManager.areNotificationsEnabled().then((e)=>{
  console.log(e); //true or false
}).catch((e)=>{
  console.log(e);
})

// ...or an async function
const enabled = await NotificationManager.areNotificationsEnabled();

Get all global notification settings

NotificationManager.retrieveGlobalNotificationSettings().then((settings)=>{
  console.log(settings);
  // {
  //   isEnabled: boolean;
  //   isBadgeEnabled: boolean;
  //   isSoundEnabled: boolean;
  //   shownInNotificationCenter: boolean;
  //   shownInLockScreen: boolean;
  //   shownAsHeadsupDisplay: boolean;
  // }
}).catch((e)=>{
  console.log(e);
})

Get notification Channel

NotificationManager.retrieveNotificationChannels().then((ChannelArray)=>{
  console.log(ChannelArray); //[]
}).catch((e)=>{
  console.log(e);
})

Keywords

FAQs

Package last updated on 02 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc