Ionic android push notification works only in background - android

I'm building an Ionic App which uses push notifications. I followed the documentation from here . I can register, I see the token is registered OK, but when I send notifications from ionic, I receive them only if the app is in background. If the app is running, I get no notification . The event cloud:push:notification is not triggered.
Any ideas?
Thanks!

Make sure to use the ionic-cloud library for interfacing with Ionic.io. The event you mentioned is not triggered by the deprecated ionic-platform-web-clinet
http://docs.ionic.io/migration.html#push`

Related

Flutter – push notifications not working in the background when app is killed

I'm trying to build a real time chat app.
I have integrated https://pub.dev/packages/flutter_local_notifications package for push notifications and this works.
I am NOT using Firebase, i am using my own custom backend that uses https://socket.io/ for real time chatting.
I want to receive a push notification when the user sends a chat message. Push notifications work when the app is in foreground or background. However when i terminate my app from the process (app is killed), the push notifications no longer work.
Is there a way to send push notifications without using Firebase so that i can receive notifications even when my app has been terminated from the process? I need this to work both for android and ios.
Basically, I don't recommend any solution for push notifications instead of firebase.
But if you have your reasons to use socket in this case I suggest you take a look into this package how it uses background service and tries to implement your own way to setup socket-based notification background service.
https://pub.dev/packages/background_locator

cordova-plugin-firebase unregister to push notification

I am using the cordova-plugin-firebase plugin to receive push notifications from firebase to my iOS and Android devices.
What I want is, that the user can disable or enable the push notificications through the app.
Everything works fine, except for the unregister part.
I am using the window.FirebasePlugin.unregister(); function.
After that, my iOS devices won't receive messages anymore, which is good.
But after trying to register again, with the window.FirebasePlugin.getToken(); function, my iOS device still won't get any messages.
So on iOS I can't register again. On Android however, the unregister function won't work at all. I still get all notifications send from firebase.
What am I doing wrong ? How can I register and unregister?

Get push notification payload when opening app, Android Titanium Appcelerator

I have activated push notifications in my application and I have done all the settings with Google and Apple to be able to send from the Appcelerator Dashboard.
I can receive notifications on both Android and iOS without any problems.
In iOS, when i click the notification from the notification center, the application opens and the callback function of Ti.Network.registerForPushNotifications is executed automatically.
The problem is that in Android, the function assigned to the callback event of the cloudPush module is not executed, I understand that it will be because when opening the application the listener is not yet created.
If I receive the notification when the application is open the callback function runs smoothly.
Reading in documentation of Android seems to me to understand that the notification is included in the extras of the intent when opening the application, but I am not clear what extra is, since in Appcelerator I do not find any function to obtain all the extras.
Someone could give me an idea of ​​how to get the payload, whether or not when I click the notification the app is in the background, as if it is totally closed?
Thanks in advance.

Firebase C++ Cloud Messaging background issues

So, I have a Firebase C++ SDK integrated into my Android app and I'm having certain troubles handling my push notifications when my app is in the background.
The thing is that for some reason OnMessage method of messaging::Listener class never gets called when I launch my app through a notification, which is weird, because in a situation when my app is already in foreground when the device gets a notification - OnMessage gets called perfectly fine and I get all the info about the received notification.
AFAIK OnMessage should also be called by the Firebase sdk when a user launches/resumes the app through the notification from the notification bar so that the app could get the payload, but this doesn't happen for me for some reason and I don't know where to look (nothing in adb log, no errors, etc).
Turned out that Firebase Cloud Messaging C++ SDK for Android requires some additional coding that is not described in the integration documentation, but, can be found in the sample app on Github (https://github.com/firebase/quickstart-cpp/blob/master/messaging/testapp/src/android/java/com/google/firebase/example/TestappNativeActivity.java#L35).
When I added the missing code in onNewIntent method - FCM OnMessage callback started to work as expected;

Parse Push Notification does not work if app not in background or foreground.

All worked fine with parse push notification. When I am trying to implement a custom push notifier it works only if my app is in foreground or background.
Specifically on Lollipop this happens.
Looking forward for your help.
Don't go with Parse as its going to shutdown in early 2017. I would suggest you to use other Push Platform like OneSignal Push notification OR Urban Airship.
Regarding custom push notifier, can you please explain more what all things you are customizing in push notification message.

Categories

Resources