React Native Library for PushBots Push Notifications Service
npm install pushbots-react-native --save && npm install
run pod install in ios folder:
cd ios && pod install
react-native link pushbots-react-native
- Select the root project and then under Capabilities click to enable "Push Notifications".
- Enable "Background Modes" and check "Remote notifications".

- Open
AppDelegate.hImport RCTPushbots:
#import "RCTPushbots.h"- The add PushbotsClient propery below
@property (nonatomic, strong) UIWindow *window;
@property (strong, nonatomic) RCTPushbots *PushbotsClient;- Open
AppDelegate.m: Add PushBots code toapplication:didFinishLaunchingWithOptionsmethod (replace APP_ID with your PushBots app ID):
self.PushbotsClient = [[RCTPushbots alloc] initWithAppId:@"APP_ID" withLaunchOptions:launchOptions];Go to android/app/build.gradle app level and add this in default config
Add the following to defaultConfig in build.gradle file inside the android/app folder
defaultConfig {
manifestPlaceholders = [
pushbots_app_id: "APP_ID",
google_sender_id: "SENDER_ID",
pushbots_loglevel: "DEBUG"
]
}make sure buildToolsVersion and compileSdkVersion are set to at least 27:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
....
}in your App.js:
import { Text} from 'react-native';
import React, { Component } from 'react';
import Pushbots from 'pushbots-react-native'
Pushbots.registerForRemoteNotifications()
export default class App extends Component {
constructor(properties) {
super(properties);
Pushbots.addEventListener('received', this.onReceived);
Pushbots.addEventListener('opened', this.onOpened);
}
componentWillUnmount() {
Pushbots.removeEventListener('received', this.onReceived);
Pushbots.removeEventListener('opened', this.onOpened); }
onReceived(notification) {
console.log('Received Notification: ', notification);
}
onOpened(notification) {
console.log('Opened Notification: ', notification);
}
render() {
return (
<Text>Hello From Pushbots</Text>
);
}
}
Thanks goes to these wonderful people:
Mohamed Shaban 💻 |
Abdullah Diaa 💻📖 |
meMuhammadkamal 💻 |
amrsobhy 📖 |
ibrahimAlii 💻 |
|---|
Contributions of any kind welcome!

