GithubHelp home page GithubHelp logo

girish54321 / crossplatform-push-notifications-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alex-friedl/crossplatform-push-notifications-example

0.0 1.0 0.0 38.24 MB

Example for crossplatform push notifications with node.js and React Native

License: MIT License

JavaScript 39.64% Python 8.23% Java 9.66% Objective-C 30.77% Ruby 11.70%

crossplatform-push-notifications-example's Introduction

Crossplatform Push-Notifications Demo

This is an example for a Crossplatform Push-Notification setup that works for both Android and iOS.

The example comprises of a server application written in node.js that uses the node-pushnotifications library and a React Native app that demonstrates the usage of the react-native-push-notification library and the react-native-fcm library.

It includes an example Firebase application setup that works out of the box. In order to use your own Firebase application, replace the google-services.json in the app/android directory, respectively the GoogleService-Info.plistin the app/iosdirectory with your own (downloadable in the Firebase Console).

Requirements

Setup

  • Optional: Install yarn (npm install yarn -g)
  • Run npm install or yarn

Run demo application

Start server

  • Run docker-compose up
  • Alternatively:
    • Start MongoDB mongod --dbpath=<yourDbPath>
    • Start server npm run server

Run app

  • Start React Native app packager npm run app-pkg
  • Connect a device or start a simulator
  • Run Android app npm run android
  • Run iOS app npm run ios

What's happening?

After application startup you should see a screen which displays your device token and the information that no notification has been received yet.

The device token should have been sent to the node.js server and stored in the MongoDB.

In order to send a sample push notification to all known device tokens execute curl http://localhost:3000/push or open http://localhost:3000/push in your local browser.

The application should now display Last notification title: Crossplatform push is working.

Configuration options

Server

If you choose to run the backend locally without Docker, you can configure two parameters via environment variables:

  • DB_HOST: MongoDB host string
  • SERVER_PORT: HTTP port of the server application

App

The app uses the react-native-config library to configure its environment.

You can edit the app/.env file in order to configure the following:

Known issues

  • Usage of react-native-push-notification for iOS currently not functional. Help appreciated.

crossplatform-push-notifications-example's People

Contributors

alex-friedl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.