@emanon_/react-native-notification
v1.0.6
Published
TODO
Downloads
3
Readme
notification
Getting started
$ npm install @emanon_/react-native-notification --save
or
$ yarn add @emanon_/react-native-notification
Automatic installation
please Use react-native 0.60+, it will be autolink.
iOS
$ cd ios
$ pod install
Android
Add the NotificationsPackage
to your android/app/src/main/java/com/[app name]/MainApplication.java:
import com.facebook.react.ReactApplication;
import com.emanon.notifications.NotificationsPackage;// <-- Add this line
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 NotificationsPackage()); // <-- Add this line
return packages;
}
// ...
}
Manual installation
Manual installation is not recommend, please Use react-native 0.60+.
Usage
Most usage is like notifications in react-native-firebase
import { NotificationApp } from '@emanon_/react-native-notification';
// TODO: What to do with the module?
NotificationApp
.notifications()
.hasPermission()
.then(enabled => {
if (enabled) {
// user has permissions
} else {
// user doesn't have permission
}
});
NotificationApp
.notifications()
.requestPermission()
.then(() => {
// User has authorised
})
.catch(error => {
// User has rejected permissions
});
TODO
- APNS
- Firebase Cloude Message & GCM Message
- CN Push