Ionic Push Notification Using GCM - ionic-framework

I'm work in Ionic Push Notification App and take the reference of https://www.sitepoint.com/push-notifications-in-ionic-apps-with-google-cloud-messaging/ but in this I can't get Android Device token.
When I request from the server (https://localhost:3000/register) I'm getting 401/Undefined in server console.
Anyone help me out for this.

Related

Pusher Private channel subscribtion cannot connect to endpoint on IOS device with Ionic 4

I'm using Pusher for real chat application.
I've created a web app and a mobile app using Ionic 4.
The app use private channels, and everything works well on web enviroment.
During development i've tested the Ionic app on browser (ionic serve)
and the chat works very well.
When I tried to test the app on a real IOS Device (also XCode emulator),
i get an error in channel subscribtion
Unable to retrieve auth string from auth endpoint - received status 0 from https://...
I've tested the endpoint and works fine, even if I try to simulate the connection from the device as a simple API.
So I cannot understand where is the problem.
If I use a default channel (so no private) everything works fine also on IOS Device.
I'm thinking the problem should be on some Cordova/Ionic configuration?
Here's the code I use for Pusher setup and subscription (works if run on the browser with ionic)
this.pusher = new Pusher(this.environment.pusherKey, {
cluster: 'eu',
encrypted: true,
authEndpoint: this.mainService.hostEndpoint + 'user/pusherAuth',
});
this.pusher.subscribe(channelName)
Who's the hero who can help me solve this problem? :)
I don't want to rollback on the not a private channel just as a workaround for the problem.
for me i had the same issue and fixed that with adding 'Access-Control-Allow-Origin' header to my server response.

fcm cordova plugin is not working on ios devices

I want to show push notifications for iOS in ionic 3 app.
I am using fcm cordova plugin.
It works for android but not for iOS.
I have uploaded push certificates on firebase for development and production.
When I send notifications from the firebase console i got no error but the message is not received.
When I send notifications via HTTP i got this error 'InvalidApnsCredential'.
Can anyone help?

Ionic push notifications api returns status 410. ¿Alternatives?

I have been reading some forums and i found that ionic services are deprecated. Now developers have to find another alternatives for push and auth services. For push notifications there are alternatives such Firebase and Onesignal plugins.
I have to say that my proyect was using Ionic1 and implemented phonegap-plugin-push (~1.10.2). What should I use? and
What does it involve?
https://blog.ionicframework.com/sunsetting-ionic-cloud-push-and-auth/
https://forum.ionicframework.com/t/ionic-pro-an-push-notifications-shutdown-of-ionic-push/102813
For push services, you can still use Ionic Native Push, which is a wrapper for phonegap-plugin-push in Ionic 3. It uses Google Firebase Cloud Messaging (FCM) in the back end. See this page for a discussion on how to do it. I have been using Ionic Native Push successfully in Ionic 3.

Ionic PushNotification is not defined

I am trying to setup pushnotification so I can get the device token to later send push notifications on PHP.
I followed this tutorial https://github.com/phonegap/phonegap-plugin-push and I am still getting the error.
Uncaught ReferenceError: PushNotification is not defined
I am testing on Chrome and Android device. Both of them same message.

Add iOS push notifications to Visual Studio Cordova Project

Hi I'm following this tutorial https://github.com/ggailey777/mobile-services-samples/tree/master/CordovaNotificationsArticle
to add iOS push notification to my Cordova project but couldn't get it to work. The APNS certificate is configured and I've uploaded the p12 file to azure mobile notification.
When I run the app it shows "Registered with Azure!" and in azure notification hub I can see the registration.
However when I send test push notification using visual studio, the message result is empty.
If I use azure portal, it shows "The test notification was sent"
And my iphone never got any notifications either when it's open or closed.
Am I missing something? Any help is much appreciated.
Thanks!
You are mixing and matching technologies. You cannot use iOS Native code in an Apache Cordova app. Based on your comments, use the cordova-push-notifications plugin. The README.md in the project describes how to add it for iOS. It's relatively simple.
You will still have to deal with how to get your device registered with Notification Hubs and getting a notification sent to your device. That is covered in detail in the Azure Notification Hubs documentation.