How to add ionic push to existing Ionic app

Hello Can anyone help me to integrate push in existing ionic app . I tried with onesignal but the app doesnot load

what was the issue with Onesignal

WHen i open the app just blank white page appears . I am integrating this to existing project

What errors in console are you getting.Can you try this

ionic plugin rm onesignal-cordova-plugin
ionic platform rm android/ios

ionic platform add android
ionic platform add ios
ionic plugin add onesignal-cordova-plugin
ionic plugin add cordova-plugin-whitelist (# required for android)

Can u share the working code for app.js??

.run(function($ionicPlatform, $state) {
 $ionicPlatform.ready(function() {
var notificationOpenedCallback = function(jsonData) {
 if (jsonData.additionalData) {
   if (jsonData.additionalData.myappurl)
     $state.go('', {'postId': +   jsonData.additionalData.myKey});
.handleNotificationOpened( notificationOpenedCallback )

I had this previous in app.js
.run(function($ionicPlatform, $ionicPopup, $rootScope, AppService, appConfig, $injector, AuthService) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
if (window.StatusBar) {
// org.apache.cordova.statusbar required
try {
if(appConfig.ENABLE_PUSH_PLUGIN) {
var NotificationService = $injector.get(‘NotificationService’);
catch(err) {
title: $rootScope.appLanguage.MESSAGE_TEXT,
template: ‘Push Notification plugin not found’
// Use the authManager from angular-jwt to check for
// the user’s authentication state when the page is
// refreshed and maintain authentication

            // Process the auth token if it exists and fetch the profile

SHould i remove this ?? or what to include the code u pasted?

Where is the Code for NotificationService?
You can try out my code and see it works or not,

Actually i had these code already in my app.js. So i was asking should i delete these and add your code?

I dont know what is written inside $injector.get(‘NotificationService’)
So, i can’t comment on why its not working.

My code works for me and its directly referred from the OneSignal Latest Documentation.

I used the push service from (Ionic Push) with my Ionic 1 app and it worked fine … and it’s free (up to a limit).

using this code gives a white screen onn android

What errors you are getting on console?