ionic push base

Ionic Push Notifications Base App for iOS and Android

166
64
TypeScript

Ionic Push Base

This can be used as base template for Ionic Push apps. It’s working for both iOS and Android Push Notifications.

Tutorial

Prerequisites

node -v
 - should be >= 6.0.0
npm -v
 - should be >= 3.0.0
  • For iOS, update XCode version to 8.0 or higher
  • Install cocoapods, required by latest version of phonegap-push-plugin
sudo gem install cocoapods
pod setup

Getting Started

  • Clone this repository

  • Install Ionic, cordova and node_modules

    $ npm install -g ionic cordova
    $ npm install
    
  • Generate SENDER_ID using this tutorial πŸ‘

  • Replace YOUR_SENDER_ID in config.xml and app.ts with above SENDER_ID

Android

    $ ionic cordova platform add android
    $ ionic cordova build android
    $ ionic cordova run android

iOS

    $ ionic cordova platform add ios
    $ ionic cordova build ios
Run using XCode

####Use device token printed in console for push notifications using below server code

Push Notifications Preview in lock screen and while using App

  • Android

    Notification on Lock Screen Notification While Using App
  • iOS

    Notification on Lock Screen Notification While Using App

Server Code

Push Notifications Server code πŸŽ‰πŸ‘
It has server code used to send Push Notification to iOS and Android device.

File Structure of App

ionic-push-base/
|-- src/
|    |-- app/
|    |    β”œβ”€β”€ app.ts
|    |    └── app.module.ts
|    |    └── main.ts
|    |
|    |-- pages/                          * Contains all of our pages
β”‚    β”‚    β”œβ”€β”€ details/                   * Push Details tab page
β”‚    β”‚    β”‚    β”œβ”€β”€ detail.html           * DetailsPage template
β”‚    β”‚    β”‚    └── detail.ts             * DetailsPage code
β”‚    β”‚    β”‚
β”‚    β”‚    β”œβ”€β”€ home/                      * Home page
β”‚    β”‚    β”‚    β”œβ”€β”€ home.html             * HomePage template
β”‚    β”‚    β”‚    └── home.ts               * HomePage code
β”‚    β”‚    β”‚
β”‚    β”‚    β”œβ”€β”€ tabs/                      * Tabs page
β”‚    β”‚    β”‚    β”œβ”€β”€ tabs.html             * TabsPage template
β”‚    β”‚    β”‚    └── tabs.ts               * TabsPage code
β”‚    β”‚    β”‚
β”‚    β”œβ”€β”€ theme/                          * App theme files
|    |     β”œβ”€β”€ variables.scss            * App Shared Sass Variables
|    |
|    |-- index.html
|    |-- manifest.json
|    |-- service-worker.js
|
β”œβ”€β”€ .editorconfig                        * Defines coding styles between editors
β”œβ”€β”€ .gitignore                           * Example git ignore file
β”œβ”€β”€ LICENSE                              * MIT License
β”œβ”€β”€ README.md                            * This file
β”œβ”€β”€ config.xml                           * Cordova configuration file
β”œβ”€β”€ ionic.config.json                    * Ionic configuration file
β”œβ”€β”€ package.json                         * Defines our JavaScript dependencies
β”œβ”€β”€ tsconfig.json                        * Defines the root files and the compiler options
β”œβ”€β”€ tslint.json                          * Defines the rules for the TypeScript linter