VirtuoZ
VirtuoZ

Reputation: 163

Ionic 1 push notification

Does someone have experience with ionic 1 push notifications? Is there any alternative to cloud solution that they suggest? And can someone show example of implementatio? And please have on mind that I'm completly new in ionic

Upvotes: 2

Views: 3946

Answers (3)

Abhijith C S
Abhijith C S

Reputation: 89

Check out OneSignal. It's free, easy to use and multi-platform Push Notification framework.

Upvotes: 0

r0b3rt0
r0b3rt0

Reputation: 206

After test several push servicies (ionic push service, parse, pushwoosh and one signal) we choose one signal as push notification provider. Right now we use it in 30+ production applications in our company. In 10 minutes or less you can set up an app for first push notification use in android or iOS (platforms we are working right now)

The platform has an easy set up guide. The only code in app for basic setup is:

$ionicPlatform.ready(function() {

   // Enable to debug issues.
  // window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});

  var notificationOpenedCallback = function(jsonData) {
    console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
  };

  window.plugins.OneSignal
    .startInit("YOUR_APPID")
    .handleNotificationOpened(notificationOpenedCallback)
    .endInit();

  // Call syncHashedEmail anywhere in your app if you have the user's email.
  // This improves the effectiveness of OneSignal's "best-time" notification scheduling feature.
  // window.plugins.OneSignal.syncHashedEmail(userEmail);
})

Just modify "YOUR_APPID" by yours and thats all. Follow de docs above for make it works in your desired platform.

Upvotes: 1

Vitor Hugo F. Lopes
Vitor Hugo F. Lopes

Reputation: 101

I use this plugin https://github.com/phonegap/phonegap-plugin-push to handle push notification.

var pushOptions = {
    android: {
        senderID: "1234567890",
        icon: "push_icon",
        iconColor: "#FFF"
    },
    ios: {
        alert: true,
        badge: true,
        sound: true
    }
};

var push = PushNotification.init(pushOptions);

push.on('registration', function () {});

push.on('notification', function () {});

Upvotes: 4

Related Questions