Skip to content

Push notification demo app built with Ionic2 and PhoneGap Plugin

Notifications You must be signed in to change notification settings

TongZhangzt/Ionic2-push-notification

Repository files navigation

Ionic2-push-notification

Client-Side Code

  • Install Node, Ionic, cordova and node_modules
$ npm install -g ionic
$ npm install -g [email protected]
  • Clone this repository
$ git clone https://github.com/TongZhangzt/Ionic2-push-notification.git
$ cd Ionic2-push-notification
$ npm install
  • Install Phonegap Plugin, set you sender id
$ Cordova pulgin add phonegap-plugin-push --variable SENDER_ID="xxxxxx"
  • Replace sender_id in app.component.js

Android

Build and run in Android

$ ionic platform add android
$ ionic run android

iOS

Build and run in ios

$ ionic platform add ios
$ ionic build ios

In ios app, you need to run the xcode file in the platforms/ios folder with Xcode.

Server-Side Code

  • Replace the device token printed in console for push notifications in gcmService.js.

  • Run the server code to push notifications:

$ cd server
$ npm install
$ node gcmService

Go to localhost:3000/push to send a push notification

About

Push notification demo app built with Ionic2 and PhoneGap Plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published