Ionic and Pusher

I was able to successfully create a mobile admin web app using Laravel and also implemented Push using Pusher.

I’m definitely able to receive the Push Broadcasts from my Pusher Channel. However, I’ve no idea how to turn them into actual push notifications on a mobile device (I’m currently using console.log() to see if I’m receiving them, and I am.

Before sending…

After sending…

How do I turn those console.log()s into actual device notifications?

Laravel

Laravel Framework 5.4.24

Ionic

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 6.5.0
    Ionic CLI        : 3.3.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.3.0
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Cordova Platforms               : none
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v6.10.3
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
1 Like

Hi cnswico,

as far as I know you are not able to create device push notifications from inside an app.

There is a whole own eco system for creating and receiving push notifications for each operating system. For example you need certificates for sending push messages on iOS and you need a SenderID in order to send push notifications to Android devices.

What you are trying to do is kind of an in-app notification mechanism. So you when receiving a notification you could for example vibrate and show a Popup with the message.

But I dont think there is a way to create real device push notifications without using the os mechnisms. They are fairly well described here: http://docs.ionic.io/services/push/

Using the in-app way you described, you could for example never receive a notification while your app isnt running.

Best regards,
sechle

1 Like

Followed some other tutorial on getting this done using Firebase and got it to go. I guess it would be easier to just make my App Admin use FCM instead of Pusher. But nonetheless, you’re correct. Didn’t really pay full attention to the docs until I read your reply. Thanks!

Can you please help me on how to integrate Pusher in Ionic ? i need it for a chat app and i don’t know what to do, i’ve already added the script on index.html but i don’t know how to import it inside a .ts file

Unfortunately, I can’t help you with that. As I’ve said, I abandoned Pusher in favour of Firebase Cloud Messaging. It’s way easier to implement in my case. For yours (a chat app), I think going FCM would be a bad idea. It’d be best to keep Pushing. (get it?)

You’re gonna have to look for guidance somewhere else. Sorry, mate.

hey @robgaleano have you got any solution?
i also need to implement chat in ionic(version 1) .Please help me

hey, yep this was the solution https://www.npmjs.com/package/pusher-js

2 Likes

:+1: thank you @robgaleano .
i ll try it.

please send me source code