1.0.5 • Published 6 years ago
react-native-check-notification-permission-c v1.0.5
react-native-check-notification-permission
Demo
iOS

Android

Getting started
$ npm install react-native-check-notification-permission --save
Mostly automatic installation
$ react-native link react-native-check-notification-permission
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-check-notification-permissionand addRNCheckNotificationPermission.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNCheckNotificationPermission.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Note
Because library written in Swift you need to add this $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) to the library search paths of your target.
You also set Always Embed Swift Standard Libraries to Yes under your Build Settings > Build Options
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNCheckNotificationPermissionPackage;to the imports at the top of the file - Add
new RNCheckNotificationPermissionPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-check-notification-permission' project(':react-native-check-notification-permission').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-check-notification-permission/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-check-notification-permission')
Usage
import {changeNotificationSetting,checkNotificationPermission} from 'react-native-check-notification-permission';
function(){
...
const bool = await checkNotificationPermission();
changeNotificationSetting();
...
}Properties
| Prop | Type | Result | Description |
|---|---|---|---|
| checkNotificationPermission | func | bool | Get status notification permission. Return true if allowed and false if deny |
| changeNotificationSetting | func | void | Navigate to setting notification screen |
1.0.5
6 years ago