sgrebnov / cordova-plugin-azure-notificationhub

Apache License 2.0
11 stars 36 forks source link

Azure Notification Hub with Phonegap App #7

Open Iknuts opened 9 years ago

Iknuts commented 9 years ago

Hi, Im a newb to push notifications, but im looking for the best way to send xPlat push notification for phonegapp apps. I came across Microsofts Notification hub which "on paper" seems to serve all my needs.. I found this plugin in the Phonegap Build but i can't seem to get it to work.

Below is the code taken from the Usage Tutorial, but i can seem to get is to work, it doesnt report a thing! or maybe i don't know how debug effectively with the phonegap build, both ways, here you go:

//connection string and hub name not provided

 var hub = new WindowsAzure.Messaging.NotificationHub(notificationHubPath, connectionString);

       hub.registerApplicationAsync().then(function (result) {
           window.plugins.toast.show("Registration successful: " + result.registrationId, "long", "bottom", function (a) { console.log('toast success: ' + a) }, function (b) { alert('toast error: ' + b) });
       });

       hub.onPushNotificationReceived = function (msg) {
          alert("Push Notification received: " + msg);
       };

Has anyone had any luck getting Push notifications to work using PhoneGap and Azure?

PLEASE HELP!

kallotec commented 9 years ago

Hey there, I recently went through the same rigmarole.

In the end I had to use the combination of PushPlugin plugin (google it) to receive notifications, and Azure Notifications Hub to register for them, for proper cross platform push notifications using Azure.

Note that the Notifications Hub plugin doesn't fully implement specific tag registration, but some tweaks to the java and ios code to pipe through to this right native lib overload fixes that.

Also note I used Notifications through the Service Bus method on Azure, rather than Data Services.

Also note if you're debugging on Ripple emulator, custom plugins (above) dont work.

Hope that helps

-----Original Message----- From: "Iknuts" notifications@github.com Sent: ‎1/‎6/‎2015 14:30 To: "sgrebnov/cordova-plugin-azure-notificationhub" cordova-plugin-azure-notificationhub@noreply.github.com Subject: [cordova-plugin-azure-notificationhub] Azure Notification Hub withPhonegap App (#7)

Hi, Im a newb to push notifications, but im looking for the best way to send xPlat push notification for phonegapp apps. I came across Microsofts Notification hub which "on paper" seems to serve all my needs.. I found this plugin in the Phonegap Build but i can't seem to get it to work. Below is the code taken from the Usage Tutorial, but i can seem to get is to work, it doesnt report a thing! or maybe i don't know how debug effectively with the phonegap build, both ways, here you go: //connection string and hub name not provided var hub = new WindowsAzure.Messaging.NotificationHub(notificationHubPath, connectionString);

   hub.registerApplicationAsync().then(function (result) {
       window.plugins.toast.show("Registration successful: " + result.registrationId, "long", "bottom", function (a) { console.log('toast success: ' + a) }, function (b) { alert('toast error: ' + b) });
   });

   hub.onPushNotificationReceived = function (msg) {
      alert("Push Notification received: " + msg);
   };

Has anyone had any luck getting Push notifications to work using PhoneGap and Azure? PLEASE HELP! — Reply to this email directly or view it on GitHub.=

Iknuts commented 9 years ago

@klingdigital , thanks! i've tried using the PushPlugin but it also seems to have issues with firing the onNotificationGCM event, i can't seem to find my way around that either! But that said, how do you feel about PushWoosh?

Because i have a .Net Backend (winforms) and i want to use that to SEND push notifications to multiple platforms... so im not sure which approach to take...

kallotec commented 9 years ago

Np.

Try minimizing the app and seeing if it fires - some events only fire when app is minimized. Push can behave differently there.

Just incase - ensure the google cloud account is setup correctly and your passing through the correct GCM ID to the plugin etc.

I haven't experienced PushWoosh before, so cannot comment on that sorry.

On Tue, Jan 6, 2015 at 3:44 PM, Iknuts notifications@github.com wrote:

@klingdigital https://github.com/klingdigital , thanks! i've tried using the PushPlugin but it also seems to have issues with firing the onNotificationGCM event, i can't seem to find my way around that either! But that said, how do you feel about PushWoosh?

Because i have a .Net Backend (winforms) and i want to use that to SEND push notifications to multiple platforms... so im not sure which approach to take...

— Reply to this email directly or view it on GitHub https://github.com/sgrebnov/cordova-plugin-azure-notificationhub/issues/7#issuecomment-68818575 .

Iknuts commented 9 years ago

Think you could show me a full sample of how you got the azure plugin to work alongside the push plugin? I would be forever indebted to you!!!

kallotec commented 9 years ago

Check the repos under my profile, just uploaded a sample app.

Iknuts commented 9 years ago

Kling, im gonna give you credits in my app! thank alot man... all the best on your work and i hope you'll be able to help me out with any other problems or queries! Again Awesome stuff!

kallotec commented 9 years ago

Nah no need, just a code comment link at top of my Pushman.js to my github repo will suffice :-). Any further problems with android will be IDs and hub connection values

Iknuts commented 9 years ago

You got it bra

Iknuts commented 9 years ago

Hi, I've successfully managed to register the mobile app on the hub... I even sent a targeted notification using a console application (as per the MSN tut), but when I put it in a winforms application, it causes the application to crash... any ideas?

Iknuts commented 9 years ago

Hi, I've successfully managed to register the mobile app on the hub... I even sent a targeted notification using a console application (as per the MSN tut), but when I put it in a winforms application, it causes the application to crash... any ideas?

lmueller74 commented 9 years ago

Iknuts - any luck? I'm looking at building a cordova app that supports push for all the notification networks (iOS, Android, Windows Phone and Windows 8?). Are you doing the same? Can you use Azure Notification Hub for all of these platforms? I've read that you can, but am just starting the process....any tips you can share would be helpful - thanks!