react-native-gcm-ios

0.1.1 • Public • Published

React Native GCM for IOS npm version

This provides a RN wrapper for using Google Cloud Messenger for iOS. Since Android uses GCM, this allows your backend to send cross platform push notifications easily by hitting the same endpoint.

This does not handle actually displaying or handing notifications - it only gets GCM tokens. You should use react-native-push-notification for that part.

Installation

This module requires using CocoaPods in order to install. This is a good article if you haven't set up CocoaPods with RN yet

npm install --save react-native-gcm-ios

Add this pod to your podfile

pod 'react-native-gcm-ios', :path => '../node_modules/react-native-gcm-ios'

Follow the directions in the GCM docs to get an APNS certificate, upload it, and get a GoogleService-Info.plist to add to your project.

Usage

import GcmIOS from 'react-native-gcm-ios'
import PushNotification from 'react-native-push-notification'
 
GcmIOS.addListener('register', (gcmToken) => {
  //send the token to your backend here
})
 
GcmIOS.addListener('error', (error) => {
  console.log(error);
})
 
PushNotification.requestPermissions()

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-gcm-ios

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • cmcewen