Skip to content

Instantly share code, notes, and snippets.

View blueberry404's full-sized avatar

Anum Amin blueberry404

View GitHub Profile
@blueberry404
blueberry404 / App.js
Last active July 15, 2018 16:28
Add listeners for Push notifications using Firebase
import firebase from 'react-native-firebase';
export default class App extends Component {
async componentDidMount() {
this.checkPermission();
this.createNotificationListeners(); //add this line
}
////////////////////// Add these methods //////////////////////
@blueberry404
blueberry404 / App.js
Last active September 6, 2019 13:32
Handling permissions for Push notifications using Firebase
import React, {Component} from 'react';
import { AsyncStorage } from 'react-native';
import firebase from 'react-native-firebase';
export default class App extends Component {
async componentDidMount() {
this.checkPermission();
}
@blueberry404
blueberry404 / AppDelegate.h
Created July 12, 2018 21:48
AppDelegate file - React Native Notifications
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
@blueberry404
blueberry404 / build.gradle
Created July 12, 2018 21:18
App Module build gradle for React Native Notifications
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.facebook.react:react-native:+'
//Add these lines
implementation "com.google.android.gms:play-services-base:15.0.0"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-messaging:15.0.2"
}
@blueberry404
blueberry404 / Podfile
Created July 12, 2018 17:43
Podfile snippet for React Native Notifications
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'ReactPushNotifications' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for ReactPushNotifications - Add these lines
pod 'Firebase/Core'
@blueberry404
blueberry404 / build.gradle
Created July 12, 2018 17:20
Root build gradle snippet for React Native Notifications
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.1'
}