Push Notification FCM on Meteor 2021

Hi. It was done a few months ago. There are a few bugs on the current library that are related to new updates in terms of push notifications. But mostly of the hard work is done for you. Feel free to post any questions / issues that you have.

raix:push is now under community maintenance:

I won’t consider this package as updated.
All the new updates are Readme.MD related. But you can take look.

I will check it out, but I am still struggling with my android setup (ios setup was super easy, but I’ve spent all of yesterday trying to get the android emulator to work and I got it to start the app but it doesn’t seem to connect to the server (no Hot Code Push), even though the browser in the emulator got access to my dev server.

Hmm, downloading raix:push on atmosphere returns 4.0.0 but the meteor-community repo is at 3.0.2

I had the same problem. but if you check the last commits there is not too much difference.

What type of error are you having on Android using fcm?

I have not even got the frigging Android emulator to run properly. I finally got to the point where the emulator starts the app, but it does not seem to connect to the dev server (no hot code push either). The emulator’s chrome browser can connect to the dev-server and displays the web content, though.

1 Like

By default webview of android app blocks connection. You need to make sure in your mobile-config.js you allow this.

App.appendToConfig(`
   <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
       <application android:usesCleartextTraffic="true"></application>
   </edit-config>
`);

1 Like

Oh thanks. It’s working now.

This information should definately go into the guide (now that I knew what to look for I found it in the api documentation, but it’s really easy to miss).

I am at a point now where I think I should be able to send push notifications with activitree:push but it’s failing without logging any errors.

Did you activate debugging for activitree:push?

yes, in CordovaPush.Configure debug is set to true.
wait i think i found the problem…
no, i found a problem but now I am back to things not working without error messages + mac os 11.3 killed my android emulator (ios development still fine, thank god)

Ah ok, I only thought I had debugging enabled on the server (I had added the debug: true in the Configure options just like you do on the client). So I got proper debug logs now and the problem seems to be an Auth error.

Hi @paulishca is there any installation guide for this package or the whole push notification implementation on meteor? I want to use this for a new project but couldn’t see an installation guide. So it would be really helpful if you provide that.

Hi, all documentation is within the github repo. Please note that the example contains not a Meteor project but a folder structure that suggests where various pieces go to into your own project.

Hi,

Is the plugin functional with 2.6.1 or later ?

While trying to build for Android, I looked at the Issues and I found this thread: Meteor 2.5.1 compatibility · Issue #47 · activitree/meteor-push · GitHub named Meteor 2.5.1 compatibility.

We do get the same build errors as listed in the first post of the thread.

How can we help ? Push notifs are new to us

Are people using this plugin unable to upgrade to Meteor > 2.5.1 ??

Best regards,

Chandi

You can look here for a hack / Cordova plugin: Mobile App generation Cordova issues with 2.5.1 [Solved]
There’s some duplicate entries for google services in the gradle files; I wonder whether this should be addressed in meteors build process…

Oh great! Thanks a lot!
That works perfectly!

Only one bug we face:

in the iOS console (Xcode), we see this:

Main Thread Checker: UI API called on a background thread: -[UIApplication setApplicationIconBadgeNumber:]
PID: 53071, TID: 4612793, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   hoptimize                           0x00000001041bea20 __19-[PushPlugin init:]_block_invoke.278 + 1016
5   libdispatch.dylib                   0x000000010489bce4 _dispatch_call_block_and_release + 24
6   libdispatch.dylib                   0x000000010489d528 _dispatch_client_callout + 16
7   libdispatch.dylib                   0x000000010489fcc4 _dispatch_queue_override_invoke + 888
8   libdispatch.dylib                   0x00000001048af048 _dispatch_root_queue_drain + 376
9   libdispatch.dylib                   0x00000001048af970 _dispatch_worker_thread2 + 152
10  libsystem_pthread.dylib             0x00000001dca46568 _pthread_wqthread + 212
11  libsystem_pthread.dylib             0x00000001dca49874 start_wqthread + 8
2022-04-14 16:41:34.713668-0400 hoptimize[53071:4612793] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication setApplicationIconBadgeNumber:]
PID: 53071, TID: 4612793, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   hoptimize                           0x00000001041bea20 __19-[PushPlugin init:]_block_invoke.278 + 1016
5   libdispatch.dylib                   0x000000010489bce4 _dispatch_call_block_and_release + 24
6   libdispatch.dylib                   0x000000010489d528 _dispatch_client_callout + 16
7   libdispatch.dylib                   0x000000010489fcc4 _dispatch_queue_override_invoke + 888
8   libdispatch.dylib                   0x00000001048af048 _dispatch_root_queue_drain + 376
9   libdispatch.dylib                   0x00000001048af970 _dispatch_worker_thread2 + 152
10  libsystem_pthread.dylib             0x00000001dca46568 _pthread_wqthread + 212
11  libsystem_pthread.dylib             0x00000001dca49874 start_wqthread + 8
2022-04-14 16:41:39.537794-0400 hoptimize[53071:4612793] PushPlugin.register: clear badge is set to 1
2022-04-14 16:41:39.537868-0400 hoptimize[53071:4612793] PushPlugin.register: better button setup
2022-04-14 16:41:39.540477-0400 hoptimize[53071:4612793] FCM Sender ID 1007248119911
2022-04-14 16:41:39.540689-0400 hoptimize[53071:4612585] Received memory pressure event 2 vm pressure 0

The problem is that it completely freezes the UI for 6 seconds. That happens when we do the Configure/Registration.

Has anybody seen that before ?

I see it herel, 15 months ago and paulishca closed the issue because of lack of interactions in the thread.

I guess it’s in the phonegap plugin as I see this other user face it too using Ionic : https://github.com/danielsogl/awesome-cordova-plugins/issues/3988

I can ask in the cordova-plugin-push repository but we’re using the deprecated phonegap-plugin-push and the “forum” is now closed.

Have you guys tried to depend on cordova-plugin-push instead ? does it work out of the box when changing the dependency?

Regards,

As soon as we disable clearBadge: true, the problem goes away.

image

So we just need to find a way to clear badges in a different way.

The solution is to remove clearBadge:true from the Configure because the configure, in phonegap-plugin-push, is run in a background thread and newer iOS versions don’t seem to appreciate it very much.

We must then run it manually from our code:

CordovaPush.push.setApplicationIconBadgeNumber(
	function () {console.log('setApplicationIconBadgeNumber2(0) successcallback');},
	function () {console.log('setApplicationIconBadgeNumber2(0) errorcallback');}, 0);