How can PhoneGap/Ionic process push notifications from Parse? - android

I can successfully push notifications to an app, and they show up on my Androids notifications, but I can't get the payload into the app.
I've found this plugin: PushPlugin, but I can't seem to get it to work with Parse, since it asks for a GCM ID, and I don't know what to give it from Parse. Also, the plugin doesn't seem to offer a way to register to certain channels, or even get an installation ID from Parse.
If I include this plugin: phonegap-parse-plugin to take care of the installationID/channels stuff, then I get a runtime error that randomly pops up (adb logcat) saying it can't find com.parse.GcmBroadcastReceiver, and the app crashes.
I just want an Ionic app that can receive a push notification from Parse, and simply display it.

I was in the same boat a week ago and trudging through it here's what I've found:
Here's the best fork I could find for the integrating with parse on cordova(ionic) on android and iOS
https://github.com/grrrian/phonegap-parse-plugin
Make sure to rename the ionic plugin add in the instructions to the grrrian repo not the avivais one in the READ.ME
(He wanted to merge the branch, but I think avivais has finished maintaining it, so the PR is sitting dead)
There will be a compile error brought on by the new ionic Crosswalk feature which is trivial (heh.. ) to fix. Follow these instructions:
https://github.com/katzer/cordova-plugin-local-notifications/issues/426#issuecomment-113166439
Lastly, you need to create an Application Class manually as per the instructions. I didn't know how to do it so I made a comment here about it that should be helpful
https://github.com/grrrian/phonegap-parse-plugin/issues/8#issuecomment-118955744
I'm in the midst of trying to figure out why the notification isn't being received while its in the background though..
Hope this helps someone
EDIT:
Turns out it works fine in the background. All the notifications came in overnight. My thought is that Parse throttles if you send too many messages to one user at once

Related

Push notifications not working on White-Label Rocket Chat App

So I am compiling Rocket Chat to use my own Firebase server so I can server notifications without worrying about hitting the notification limit. I've followed the steps here and gotten a working Experimental version of the app on Android, but I can't seem to get the notifications to work. Checking Firebase shows no users of my app, though sometimes it will register a single user but that's it. I've got to be missing something simple, but I can't figure out what. Any help or tips would be greatly appreciated! Thanks.
If you need any more information just let me know.\
UPDATE: I can send test notifications from Firebase and they show up on the device, however they are not marked as read in Firebase when clicked. It seems as if notifications work from Firebase, but it has no way to communicate back to Firebase.
FINAL UPDATE: It turns out that Rocket Chat server needs the legacy version of the FCM keys. By replacing the existing google-services.json file with the one provided by Firebase and following the instructions to get the legacy keys caused notifications to work. Hopefully someone else can benefit from this insight.
FINAL UPDATE: It turns out that Rocket Chat server needs the legacy version of the FCM keys. By replacing the existing google-services.json file with the one provided by Firebase and following the instructions to get the legacy keys caused notifications to work. Hopefully someone else can benefit from this insight.

Firebase Cloud Messaging not working on Android with Flutter app

I have a Flutter app registered with Firebase for both iOS and Android. The FCM (push notifications) is meant to work for Android as per https://firebase.flutter.dev/docs/messaging/overview/ pretty much out-of-the-box.
Alas, it doesn't.
I added it to pubspec.yaml. I actually added firebase_messaging: ^7.0.3 because anything newer breaks other dependencies. Then I go to Firebase console and send a test message targeted at my Android registered app. Once the message goes through and it says it is Completed no message comes to my simulator.
I know FCM on iOS has an issue with simulator but I have not read anything about it being a case on Android.
I added import 'package:firebase_messaging/firebase_messaging.dart'; and instantiated FirebaseMessaging messaging = FirebaseMessaging(); both in main and results are as above i.e. nothing comes through to my simulator's notifications.
The strangest thing is that I originally followed https://sebastianengel.medium.com/easy-push-notifications-with-flutter-and-firebase-cloud-messaging-d96084f5954f which is substantially more involved and I did get first notification(sic!) but not any subsequent ones. I tried to do this solution from ground up again but the notifications on my simulator remained indifferent.
One thing to bear in mind is that I use few other Firebase services so I know my app is correctly registered with Firebase... unless there's some additional step that I missed and can't see.
Anyone please went through the same ordeal and can pinpoint my blindspot? Thank you.
UPDATE -
I checked error logs and they are empty.
Could you post some more information? For example the console log when you send a notification (try troubleshooting with basic print statements also), better still, send a reproducible snippet of code so I can recreate your problem.
Also make sure you initialize notification handling at a top level function (main preferably).
I'd be happy to work with you, reach me on seanonuoha#gmail.com, when we fix the problem, you post the results here.
Cheers
If you follow the steps in this documentation and still got no message or notification you can check your emulator settings.
Emulator stands default SERIAL CONSOLE DISABLED.
Slide it and turn it to enabled.
My problem solved with this issue.
If you tried and still get problem. Do not hesitate to ask again.
....

Can I use onesignal to trigger change order status automatically?

Can I use Onesignal to send a notification of order changes to an Android device then if the user already opened the application on order's page/view the notification will be not shown but the order status on that page will be changed?
If yes, can I know the reference of documentation/tutor? If no, what are alternative ways to do it?
I have a project using Onesignal to send the notifications to the android devices. Currently just Simple notif, but my boss asked me to make the mobile app can auto change status order without user action. I'm a backend engineer, not an android dev so I don't know what really works of Onesignal in android. I just know Onesignal can be used to send the notification but what about data process after notification sent?
This is what I understood: Your app has some kind of market or something from which people can order stuff. So, you want to know if OneSignal can send automated notifications as the order status changes?
If I have got it correct, my best guess will be, no. OneSignal can only manually send out notifications. The closest one can get with OneSignal to automations is scheduling notifications to be sent later. To achieve your purpose, your Android devs will probabaly have to write some code on their own and integrate it some way with the order status and all. Or else, your boss will have to appoint a few people who can track the order of the people and manually send out notifications to them using OneSignal (but, identifying the correct device might not be so easy).
That's my guess. But, OneSignal's support team is pretty nice. They might take a few days to answer, but, it's worth asking them if they can help your developers integrate the order status and OneSignal's notifications in some way.

Google Play Services 8.4.0 breaks Google Cloud Messaging for Android if iOS is also used

There are several posts that describe aspects of this issue, but there hasn't yet been a satisfying answer, so I'm attempting to collate them all here in hopes of getting an authoritative answer that can address all of these issues.
After updating Google play services to 8.4.0 push notifications displayed by themselves
Android notification is not showing it's content when app is not running
what does gcm.notification.e=1 stand for, into push notification payload on Android?
The gist of the problem is that if you create a GCM message with data only (i.e. not using the notification field, and thus not intending for it to generate a notification) AND you include content_available=True (which is necessary to get the desired behavior from iOS clients), then since 8.4.0, this generates a undesirable blank notification in Android. Prior to 8.4.0, everything worked just fine.
The specifics of the problem seem to be that if the Android client receives a GCM field it doesn't understand, instead of just ignoring it, it adds an "e=1" field (presumably "e" means error?) as a notification even if there was no notification in the message before, causing it to trigger the code that makes a notification appear, rather than the code that directs it to the application to be handled.
Possible workaround: I imagine that one could keep track on the server of which clients were iOS and which clients were Android, and only include the content_available tag for the iOS clients, and this problem would be solved. However, it wasn't necessary to do this in the past, and my system was built with the idea that I could be agnostic to the client types, as it seems was intended.
The fact that the content_available flag suddenly causes these blank notifications on Android seems like a bug that was newly introduced, but it would be very useful to know if it is in fact a bug that might be fixed in 8.5.0 (in which case I could just build with 8.3.0 for now until 8.5.0 comes out), or if it is intended to be a permanent solution. If this is not going to change, is the correct solution to keep track of which GCM registration IDs belong to iOS devices and which belong to Android devices, and then to send out two separate GCM requests every time?
Thanks in advance for any official responses to this question from the Google team.
Se my answer here. The solution I found is to just send this e field with value zero on my server. For Android it worked, have not tested on iOS yet.
Today I finally got an acknowledgement from Google that this was in fact a bug, and that the fix was rolled out this week. I can also confirm that the behavior I was seeing in 8.3.0 now works the same in 8.4.0, so apparently the fix was done entirely on the server side.
I was also advised that it is in fact best practices to partition your GCM messages on the server side between those going to iOS devices and those going to Android devices, as there may be times in the future where different payloads may be needed for the different platforms.
After upgrading version 9.2.1 push notifications displayed by themselves when application is in background (#dblank solution does not work for me)
Workaround: Remove the notification node for Android
{
"to": "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...",
"notification": {}, //Remove this node when PUSH to Android devices
"data": {
"key": "value"
}
}

Android real time updates from server

I see that apps like facebook for example are getting push notifications in real time. When someone writes a message to me from a pc ill get the message to my android device as push notification just a second later even when my facebook app is not running.
Im wondering how it works because for my app i need a quite similar behaviour. There is also a messaging and an alert mechanism between server and client but i cant imagine how i could implement it so that i can get real time updates from the server to the client even when the app is not started.
Does someone know?
Yes, use Sync Adapter with GCM (Google Cloud Messaging) :
http://developer.android.com/training/sync-adapters/index.html
Read the tutorial i provided, you will at least know what to use.
And check this SO question, it has good answers (especially the accepted one) :
Sync data between Android App and webserver

Categories

Resources