1

I'm developing apps with Cordova, but I have more fundamental questions to ask so bear with me:

  1. For new apps on Google Play, I heard that you can only use FCM. I would like a double check on this.
  2. From fiddling around, I get the impression that that Android devices which support FCM has got to be API Level 24 or later. Is that true?
  3. If 2 is true, that means to support older devices, I need to use the same old GCM api on the clients. So client code would be written as they were connecting to GCM. Is that correct?
  4. Then I can just write all codes for Android as if connecting to GCM?

Currently I have trouble getting Cordova plugin for FCM to compile and working correctly. I am hoping I can just use the GCM plugin on the phone devices.

AL.
  • 33,241
  • 9
  • 119
  • 257
huggie
  • 15,393
  • 21
  • 74
  • 128

2 Answers2

1

According to Google's dev blog, the new FCM (10.x) requires API level >=14 (Android 4.0.1).

You can get a preview of the diffrence between supporting GCM and FCM by looking at the migration guide.

If you're set on supporting old devices (API level >= 9) you can stick with FCM 9.x. This would be a better approach than relying on GCM.

So IMHO there is no real reason to support GCM other than cases where you already have legacy code that you do not want to upgrade.

Vaiden
  • 14,116
  • 6
  • 55
  • 86
1
  1. Not necessarily. If you already have an app that has GCM implemented, then it's cool. If you're planning to create a new project, you'll have to go with FCM since you'll only be able to generate a Server Key (a required credential for FCM) by creating a Firebase Project.

  2. I'm not sure where you heard/seen this. Could you provide the link? Android 24 is referring to Nougat, right? Which was recently released. I don't think that they'd remove support for the other versions just like that.

    It's possible you're confusing it with the Google Play services and Firebase for Android will support API level 14 at minimum.

  3. FCM is backwards compatible with GCM. See here.

  4. No. FCM has a different implementation than GCM. I think this is specified in the Migration guide. Or were you referring to the Server Side coding? If so, then there isn't much difference.

Community
  • 1
  • 1
AL.
  • 33,241
  • 9
  • 119
  • 257
  • By no on #4, you mean the app codes on the Android devices themselves? Then that means it's not backward compatible to me. How can #3 be true? – huggie Apr 26 '17 at 09:40
  • The implementations are different. But if you have the registration tokens for the GCM implemented apps and used it to send messages through FCM, they'd should still be able to receive the message. The FCM service itself is backwards compatible with GCM. – AL. Apr 26 '17 at 09:42
  • I'm stuck. Because [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase) appears to use API like `isDeviceProtectedStorage`, which is only available in API 24 (Nougat). The alternative [cordova-plugin-fcm](https://github.com/fechanique/cordova-plugin-fcm) haven't been developed for 3 months. If I cannot use [phonegap-plugin-push](https://github.com/phonegap/phonegap-plugin-push) which interfaces with the original GCM, I have not many options left. – huggie Apr 26 '17 at 09:52
  • Hey @huggie. Sorry I can't be of further help. I haven't tried Cordova yet, so I haven't really tried any of it's plugins either. If there's an issue with the plugin, why not just comment on it on Github to bring it to the attention of the devs themselves? They might be able to help you further. :) – AL. Apr 27 '17 at 07:11
  • AL thanks for your help. The author is not answering. Perhaps it's because I have not asked the right question. Let me make sure I am not wrong is saying [isDeviceProtectedStorage](https://developer.android.com/reference/android/support/v4/content/ContextCompat.html#isDeviceProtectedStorage(android.content.Context)) is only available to Nougat and later right? – huggie Apr 27 '17 at 07:42
  • 1
    The wording would be technically correct if you use "*`isDeviceProtectedStorage` was added and is only available for version 24.0.0 and up.*" -- I think that they'd get the gist from that already (since you also included the link). – AL. Apr 27 '17 at 07:46