phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Migrate to Firebase Cloud Messaging #929

Closed macdonst closed 6 years ago

macdonst commented 8 years ago

Google is moving from GCM to FCM and this plugin should follow suit.

https://developers.google.com/cloud-messaging/android/android-migrate-fcm

I may end up supporting a 1.x and 2.x stream where the 2.x stream is FCM as it will be awhile before everyone can update to using FCM.

skyprimer commented 8 years ago

Great.! we are following the topic...

getqd commented 8 years ago

Same. Looking forward to integrating FCM into our apps!

Maximvdw commented 8 years ago

+1

lorenzob-incomedia commented 8 years ago

+1

raphaguasta commented 8 years ago

Great!! Thanks for this!

JeremyColton commented 8 years ago

FCM makes iOS APNS obsolete since FCM is reliable and free?

ghost commented 8 years ago

+1

Any ETA on this?

zishon89us commented 7 years ago

+1

waiting for it , http://stackoverflow.com/questions/37653251/firebase-cloud-messaging-with-ionic-app/

srikantk commented 7 years ago

+1

vasanthns commented 7 years ago

+1 following..

lurainsin commented 7 years ago

+1 I'm looking forward to use FCM in my new app!

andaqui commented 7 years ago

+1

JeremyColton commented 7 years ago

Please stop adding "+1" - you are spamming everyone! Just click the "subscribe" button on the right-hand-side!

GitFr33 commented 7 years ago

I am just getting started with push notifications. Would you advise going ahead and setting up GCM and migrating later, or waiting until FCM is supported?

GrzegorzWarzecha commented 7 years ago

+100!

ktzanettis commented 7 years ago

Anyone know when this issue will be committed?

jcesarmobile commented 7 years ago

When? once it's ready

macdonst commented 7 years ago

@ktzanettis you can always help out by testing the v2.0.x branch or submitting a PR.

glasset commented 7 years ago

I have tested on v2.0.x(07fa81) currently works fine (tested only fcm feature), if something bad happen i will report

stephan-nordnes-eriksen commented 7 years ago

@glasset Great to hear! I would like to try it out and help if possible. Is the setup any different than gcm?

glasset commented 7 years ago

@stephan-nordnes-eriksen yes, same as gcm setup.

neosekar commented 7 years ago

how to install the v2.0.x using cordova command ?

glasset commented 7 years ago

cordova plugin add https://github.com/phonegap/phonegap-plugin-push\\#b451b55134f716fcf172ec51d8fcfa2e4e6c32d1

b451b55134f716fcf172ec51d8fcfa2e4e6c32d1 is the last commit on v2.0.x

neosekar commented 7 years ago

If i run this command , i got the error like

error: Failed to fetch plugin https://github.com/phonegap/phonegap-plugin-push\ via git. Either there is a connection problems, or plugin spec is incorrect: Error: git: Command failed with exit code 128 Error output: Cloning into '/tmp/git/1467205453431'... fatal: unable to access 'https://github.com/phonegap/phonegap-plugin-push\/': The requested URL returned error: 400

neosekar commented 7 years ago

It is my mistake i just removed the slash before # sysmbol now it works

pleivac commented 7 years ago

I have installed this as follows cordova plugin add https://github.com/phonegap/phonegap-plugin-push.git#v2.0.x --variable SENDER_ID="XXXXXXXXX".

neosekar commented 7 years ago

cordova-plugin-fcm is build failed . it shows, > Could not find com.google.firebase:firebase-core:9.0.0.

neosekar commented 7 years ago

pushv2.0.x is working in android but in ios it shows invalidRegistration error

jcesarmobile commented 7 years ago

yeah, iOS part isn't implemented yet

skyprimer commented 7 years ago

What is the exact git url for config.xml to test v2.0 via Phonegap Build?

lukebp commented 7 years ago

this commit works for both iOS and Android. Make sure to add your SENDER_ID.
From the command line: cordova plugin add https://github.com/phonegap/phonegap-plugin-push#07fa81b7a3a62400915ac70b9a24a802465a6f95 --variable SENDER_ID="XXXXXXX"

Or add this to your config.xml file, then rebuild your ios and android builds: <plugin name="phonegap-plugin-push" spec="https://github.com/phonegap/phonegap-plugin-push#07fa81b7a3a62400915ac70b9a24a802465a6f95"> <variable name="SENDER_ID" value="XXXXXXX" /> </plugin>

neosekar commented 7 years ago

Is it implemented for ios ?

skyprimer commented 7 years ago

I've already tried that with sender ID strange but today i got no error on IOS. Android has errors on build..

pierreNeck commented 7 years ago

I have this error with Ionic+crosswalk, with the version @lukebpowell

:transformClassesWithDexForArmv7Debug UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/FirebaseException; FAILED

BUILD FAILED

Total time: 50.554 secs at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106)

FAILURE: Build failed with an exception.

stephan-nordnes-eriksen commented 7 years ago

@pierreNeck: You probably have a mismatch with the google play services version and the firebase version. If you have google play services v31 you need firebase 9.2.0.

Google play services you can find in your sdk manager. Firebase version you find in your app in build.gradle.

It will probably say something like compile "com.google.firebase:firebase-core:9.2.0"

jonohayon commented 7 years ago

+1

escolhatecnologia commented 7 years ago

+1

jcesarmobile commented 7 years ago

please, don´t +1, github added the reactions so you can +1 with the thumbs up instead of writing a comment

BTW, you can test v.2.0.x branch of the plugin that has FCM support, but it's untested, so if you install it and give feedback will be more helpful that +1s

ktzanettis commented 7 years ago

I have downloaded the latest commit and trying to make my android project to receive notifications using FCM. The FCM registration token is produced but the notification is not sent. Is there any use of the SENDER_ID used with GCM? I noticed this line in the PushPlugin: token = FirebaseInstanceId.getInstance().getToken(senderID,FCM);

Thank you

jcesarmobile commented 7 years ago

Yes, the SENDER_ID is still used with FCM. Not sure if it changes if you migrate an existing GCM project to be a FCM project, can you check your firebase console?

telemakhos commented 7 years ago

Who's testing the 2.0 branch and what are the thoughts about stability? it'd be great to have some feedback.. =)

wparad commented 7 years ago

I've been using this for GCM on android and ios (sending through AWS). The documentation on send GCM is really bad, so it was pretty confusing. If you want I can share some quirks. I have it working for the most part. The biggest problem is that if I don't init and register the plugin early enough, then I don't receive coldstart or background notifications on android (unconfirmed on ios).

Edit: THe documentation, isn't the best concerning what the setup should for the plugin to even configure it for both ios and android to both use GCM, that was a little confusing.

edtiley commented 7 years ago

My wasn't that responsive!

Never mind, I won't ask anything again

dannywillems commented 7 years ago

Any new about the migration? I don't see any new commits on branch v2.0.x or FCM.

telemakhos commented 7 years ago

@dannywillems looks like the development has stalled.. In our case we've switched to this other FCM plugin which is gaining momentum now and works for us...

dannywillems commented 7 years ago

@Telemakhos Thanks for your comment. We hesitated to migrate to this plugin.

jcesarmobile commented 7 years ago

I was asked by mail about the FCM status, so I'm answering here too mostly the same:

I don't use FCM on any real project, so it's hard for me to find real issues while using it. Last time I worked on it, I was able to receive push from FCM on both iOS and Android.

People is not opening issues about v2.0.x branch, so that can mean that it has no issues or people is not using it. I don't think v2.0.x is perfect and it has probably issues, but if I don't see the issues I can't fix them. So, if it has issues but they are not reported it's because people is not using it.

What can you do? Test v.2.0.x and report issues so we can fix them If you don't want to test it, you can switch to another plugin like the one mentioned on previous messages, but at least if you find issues on it, report them.

dannywillems commented 7 years ago

@jcesarmobile Thanks for your answer!

dannywillems commented 7 years ago

@jcesarmobile Do you think it's possible to rebase v.2.0.x branch with the master branch? I think it would help people to know FCM is WIP and get all fixes since June. It's a great job, thanks.

dannywillems commented 7 years ago

@jcesarmobile It seems it doesn't work for iOS for me. I created a project in the firebase console and add an Android and iOS application. I downloaded GoogleService-Info.plist and put it in the root project (in XCode). No error appears in XCode, no error from Google response but no notification appears on iOS.

For Android it's working, even if I didn't add google-services.json in the Android project.