activitree / meteor-push

Meteor Push Notifications for Cordova and Web/PWA with Firebase (FCM).
MIT License
27 stars 19 forks source link

Push Notifications not working for android-device #2

Closed J4si3k closed 5 years ago

J4si3k commented 5 years ago

I'm testing this lib for android and successfully launched notifications on the emulator. But if i try to run for meteor android-device (android 8.0.0) then nothing happens, device does not display notifications.

additionally in the console on the server side I see the message "Uncaught TypeError: Meteor.userId is not a function" (probably related to extracting userId from the mongo collection? that I do not use). I think that this is not an important message.

Maybe I did not set up something?

My config: client/main.js

import { CordovaPush } from 'meteor/activitree:push'

Meteor.startup(() => {

  if (Meteor.isCordova) {
    CordovaPush.Configure({
      appName: 'YourAppName',
      android: {
        alert: true,
        badge: true,
        sound: true,
        vibrate: true,
        clearNotifications: true,
        icon: 'statusbaricon',
        iconColor: '#337FAE',
        forceShow: true
      }
    })
  }
});

server/main.js

import { Meteor } from 'meteor/meteor';

Meteor.startup(() => {

  if(Meteor.isServer) {
      Push.Configure({
        gcm: {
          apiKey: 'XXXXXXX' //firebase clound messaging server key
        }
      });
  }

});

//App.js, client side component

Push.send({
                from: 'push',
                title: 'Push Notification',
                text: 'Push Notification text',
                badge: 1, 
                query: {}
 });

mobile-config.js

App.configurePlugin('phonegap-plugin-push', {
    SENDER_ID: XXXX ////firebase clound messaging sender ID
});

Libs versions:

paulincai commented 5 years ago

Hi @J4si3k I don't think your notes are related to this package. The package doesn't use GCM nor a SNDER_ID.