Aerogear and ionic


#1

Hi,

Has anyone used aerogear-cordova-push on ionic2 project, if yes can you please share some guidelines in getting it up and running.

Basically I am not able to refer the plugin in my code and keep on getting error saying Push not found!.


#2

Hi @maruti, did you get it to work?
Thanks!


#3

Also looking for a simple guide. @maruti can you share something ?


#4

Hi,
Sorry for the late response, Below is the sample code I used for getting AeroGear working for my project.

          let pushConfig = { pushServerURL: "Your push server url" };
          if (devicePlatform.toLowerCase() == "android") {
            pushConfig['android'] = {
              senderID: "senderID",
              variantID: "variantId",
              variantSecret: "variantSecret"
            }
          } else {
            pushConfig['ios'] = {
              variantID: "variantId",
              variantSecret: "variantSecret"
            }
          }
          try {
            (window as any).push.register(this.onNotification, this.successHandler, this.errorHandler, pushConfig);
          } catch (err) {
            let txt = "There was an error on this page.\n\n";
            txt += "Error description: " + err.message + "\n\n";
            console.error(txt);
            console.log(err);
          }

Hope this will help you guys.

I am using AeroGear plugin version : 3.1.0

ionic info

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.10.3
Xcode version: Xcode 8.3.3 Build version 8E3004b