Meteor-Community-Packages / raix-push

DEPRECATED: Push notifications for cordova (ios, android) browser (Chrome, Safari, Firefox)
https://atmospherejs.com/raix/push
MIT License
515 stars 197 forks source link

FCM - Android - Firebase Cloud Messaging #226

Open Wade-BuildOtto opened 8 years ago

Wade-BuildOtto commented 8 years ago

It looks like GCM is being depreciated, and FCM is now the new standard, I wouldnt expect GCM to be round for that much longer they will eventually make it so you can get GCM and then they will turn it off completely.

Neobii commented 8 years ago

In services and api's for my app, I don't see GCM as something I can manage, only FCM.

Wade-BuildOtto commented 8 years ago

under API Manager > Mobile API's > Google Cloud Messaging

its their for now but I don't know for how long.

On Wed, Jul 6, 2016 at 9:23 AM, Adam notifications@github.com wrote:

In services and api's for my app, I don't see GCM as something I can manage, only FCM.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/raix/push/issues/226#issuecomment-230806437, or mute the thread https://github.com/notifications/unsubscribe/APG2rzeY1ROqBtkF_2tmkeQJTOL0cKAiks5qS8h1gaJpZM4I8Kn9 .

raix commented 8 years ago

We should start adopting FCM when supported in the cordova (https://github.com/phonegap/phonegap-plugin-push/issues/929) - it seems like the server-side npm packages are already there (https://www.npmjs.com/search?q=FCM)

totoide commented 8 years ago

I couldn't get a GCM server key to work so I grabbed an FCM server key and used it in the "android" apiKey and projectNumber/senderID fields. So far it properly generates Android push messages (Meteor 1.4.1.1, raix:push@3.0.2, raix:eventemitter@0.1.3, raix:eventstate@0.0.4). I thought I'd volunteer this info in case it helps prioritize your work load. Thanks so much for this package!

raix commented 8 years ago

Thanks @totoide thats good news - we should update the Android documentation then,

totoide commented 8 years ago

@raix I made some quick updates to the documentation and I think I properly created a pull request #251 .

MateusAndrade commented 8 years ago

At this moment, is possible to use FCM with the plugin on both platforms( Android, IOS )?

VilleImmonen commented 7 years ago

At this moment, is possible to use FCM with the plugin on both platforms( Android, IOS )?

I would like to know this also..

bergjs commented 7 years ago

I just tested FCM and it works with Android. I actually just came here to say that if you test your notification, you have to have your app closed otherwise the notification won't show! On Android at least. This cost me many hours to find out 😆

raix commented 7 years ago

Right - so if you want to show a notification while the application is open you have to handle it yourself eg. via the native local notifications api. (showing the native notification while the app is open is not the common behaviour, could result in bad UX)

Relevant events are described in the "advanced.md" (hint "startup"/"message")

bergjs commented 7 years ago

Here's what's in my code that's related to the push notifications.

In main.js (server)

Meteor.startup(() => {
  ...
  Push.Configure({
    gcm: {
      apiKey: 'verylongkey', // from https://console.firebase.google.com/project/<project_id>/settings/cloudmessaging
    }
  });
...
}

In main.js (client)

Meteor.startup(() => {
  Push.Configure({
    android: {
      senderID: 1234, //number, not a string. From same url as above
      alert: true,
      ...
    },
    ...
  });

 ...
});

In the method

Push.send({
  from: '...',
  title: '...',
  text: `...`,
  query: {
    userId: data._id
  }
});

Other things I can think of:

ChrisKG32 commented 7 years ago

I deleted my .meteor folder and rebuilt and it worked fine. Thanks though! I tried deleting my comment but you responded before I could :)

On Apr 18, 2017 3:28 PM, "Jonas Bergert" notifications@github.com wrote:

Here's what's in my code that's related to the push notifications.

In main.js (server)

Meteor.startup(() => { ... Push.Configure({ gcm: { apiKey: 'verylongkey', // from https://console.firebase.google.com/project//settings/cloudmessaging } });... }

In main.js (client)

Meteor.startup(() => { Push.Configure({ android: { senderID: 1234, //number, not a string. From same url as above alert: true, ... }, ... });

... });

In the method

Push.send({ from: '...', title: '...', text: ..., query: { userId: data._id } });

Other things I can think of:

  • is the app closed when sending the notification? This was my mistake, see above
  • maybe you have to build the production app and install it?
  • you can send test notifications directly from Firebase to test if the client part is working: https://console.firebase. google.com/project//notification/compose

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/raix/push/issues/226#issuecomment-294971052, or mute the thread https://github.com/notifications/unsubscribe-auth/AOG_BNUx6GdAy-Y786GkEWdfw9moYO6Hks5rxRzRgaJpZM4I8Kn9 .

bergjs commented 7 years ago

Well, now it's out there to help others 😄

rhernandez-applaudostudios commented 7 years ago

Hi, Did you guys try to use topics notifications ?

haileebn commented 6 years ago

Hi @raix and everybody. I do not speak English well, hoping people will understand. How to send FCM messages without running the client? Thanks!