Create FCM app of existent GCM app - android

I have an old Android app, developed on eclipse, that use GCM for receive push messages (and a custom server that use GCM too for send push messages to app). Now i need to pass code on Android studio, so i need to keep GCM for push messaging (i'll upgrade to FCM later).
Now as i can read on GCM tutorial, i need to create an app on Firebase console and do few steps for use it on my Android app.
If i do it without update also my custom push server code, does both old and new app will continue receive push messages?

You can follow official migration from here
The gcm/fcm server endpoints are changed as(change the server code according to)
gcm-http.googleapis.com/gcm/ to fcm.googleapis.com/fcm/
gcm-xmpp.googleapis.com to fcm-xmpp.googleapis.com
You can also see in the guide that
Updating these endpoints is not strictly required, as Google will
continue to support the existing GCM endpoints.

Related

Sending push notifications in Delphi

I am trying to use Delphi (10.3.2) code to send push notifications to specific Android devices, but can't figure out how to do it properly.
The tutorials and guides I have looked at only provide help for receiving notifications (which works very nicely), but in all of them the notifications are sent directly via the Firebase console.
Is it possible to accomplish this directly in Delphi?
Sending messages to devices through Firebase Cloud Messaging requires that you call the FCM versioned API and specify the so-called FCM Server Key. As its name implies, this key should only be used on trusted environments, such as your development machine, a server you control, or Cloud Functions. The reasons for this is that anyone who has the FCM Server Key for your project can send notifications to all users of your app. So you'll not want to include this key and functionality directly in your application code.
The common approach is to set up a server-side endpoint (e.g. a self-defined API that you create on something like Cloud Functions or your existing server), and call that from your application code. The server-side code can then ensure that the user is authorized to send notifications to the folks that are targeted, and call the relevant FCM API to send the messages to the devices.
This FCM API for sending messages comes in a few flavors. I'd first consider if there's an Admin SDK for your platform, as that's the easiest way to make this work. If there is no Admin SDK, you can make HTTP calls to the v1 API directly.

Do I need to migrate GCM to FCM on client side?

I have the old android app on Play Store which I am not going to update anymore because of making a new app.
Do I need to migrate GCM to FCM in my old android app?
Many sources say:
You have to change your client side... blabla... etc...
but GCM and FCM FAQ says:
GCM tokens will continue to work on client devices.
Existing installs of client-side apps receiving notifications will continue to work for the foreseeable future. You don't need to get new tokens for all users. The existing tokens from GCM will continue to work
But from mid-April:
You won't be able to compile code using the old client-side APIs on a newer SDK/Google Play Services anymore
You won't be able to call the GCM REST API to send messages anymore
New installations of your existing GCM-using app may not be able to get a token.
To compile against the new SDK/Google Play Services, you will need to make changes to your client app to migrate to Firebase Cloud Messaging from GCM. This involves changes to the build.gradle, to AndroidManifest.xml and to your code, as described in Migrate a GCM Client App for Android to Firebase Cloud Messaging.
You need to update your client code and migrate to FCM. Because it is officially announced to do migration and it is very likely that from a point, for example by one of the android updates, they stop supporting old api callbacks and if so you will lose part of your users.
So my advice is to do the migration as it has been long enough so far that they had supported GCM along with supporting FCM and they can't and won't do it forever.

About GCM implementation Android application after April 11, 2019(GCM is abolished)

I would like to migrate a GCM Client App for Android to Firebase Cloud Messaging.
In the Firebase console, I selected my GCM project from the list of existing Google Cloud projects, and add Firebase,
and now, even if I update my server code to use new FCM endpoints for sending messages, Push notification will be sent to the existing GCM version Android application It has arrived.
Will Push notifications be sent to GCM version applications after April 11, 2019(GCM APIs will be removed)?
It seems that such meaning is written in GoogleDeveloper (※ https: //firebase.googleblog.com/2018/04/time-to-upgrade-from-gcm-to-fcm.html).
But my android app does not use "GcmListenerService" which appears in Google official migration guide.
my android app is an old implementation just after migrating a C2DM Client for GCM Client,
is the old implementation right after moving from C2DM to GCM, is my android app OK?
Current implementation
Start Service with the intent of
com.google.android.c2dm.intent.REGISTER specified, and register
registration ID
Receive BroadCast of com.google.android.c2dm.intent.REGISTRATION,
obtain registrationId and send it to business server
Receive BroadCast of com.google.android.c2dm.intent.RECEIVE,
receive push notification from the server.
For business reasons,
It is difficult to forcibly update the current user's Android application from the GCM version to the FCM version.
Thank you.
From the same blog post (emphasis mine):
If you have projects that are still using the GCM APIs, you will need to update your client and server code to use FCM before April 11, 2019.
With that, it seems you need to update the client app as well. There isn't any documentation that says that app versions that are still using GCM code would cease to receive messages, but the behavior to receive will no longer be guaranteed after the said date.
Business wise, you may not force the update, but make it so that users are encouraged to update by saying something along the lines of "An update is necessary to use the full potential of the app."
I came to the following conclusion, based on this (from further down the same blog post):
What happens to my users who don't update their apps?
As long as users have GCM logic in their apps, they will still receive messages. FCM is backwards compatible with GCM, so even if you don't update your server endpoint now, you can still update your app's logic, and vice versa.
And from the FAQ:
Note that client SDKs and GCM tokens will continue to work indefinitely. However, you won't be able to target the latest version of Google Play Services in your Android app unless you migrate to FCM.
So I'm going to play it safe and have both my server and app updated with FCM before the deadline.
But to answer your question, users who have not upgraded to the FCM version of the app should still continue to receive push notifications after the April 2019 deadline.

Can I use both GCM and FCM in my app?

I have an android project in which GCM is implemented. Back-end (server) is already coded suitably with GCM.
Now is it possible to add firebase (FCM) in my project and work in parallel with GCM? I cant migrate to FCM because it is impossible to change my back-end code as it is a big project and too much code is there. Has anyone done something like this?
Please help. Thanks in advance.
Though my particular case might be a bit specific, because the project I am involved in has a very specific backend, it seems to me FCM interoperates well with GCM, i.e you can have both in your app, GCM and FCM broadcast receivers / receiver services, and they will both work as well with no conflicts.
This has a huge advantage because you don't have to decide with migration at once, you can do this more gradually.
Well done, Google!
No, you can not use both FCM and GCM at same time. GCM is the old version and that it is strongly recommended to use FCM.
Why is Google Cloud Messaging (GCM) part of Firebase? How does it relate to Firebase Cloud Messaging (FCM)?
Google is investing in Firebase, making it our unified mobile
platform.
Over the last few years, we have expanded GCM to send messages to
multiple platforms beyond Android: iOS and Chrome. Firebase is known
for being cross platform, so FCM now makes a natural fit in the
Firebase suite of features designed for Android, iOS, and mobile web.
Another core value of Firebase is cross-feature integration. We are
adding the ability for other Firebase features to easily send messages
via FCM. For example, you can use Firebase Notifications to send
reengagement messages to your users.
We think that GCM will be even more useful to developers as an
integrated part of Firebase. You can still get the same great product,
now under a new name: "Firebase Cloud Messaging," or FCM for short.
Is GCM going to be deprecated?
We will continue to support the current version of GCM Android and iOS
SDKs because we know a lot of developers are using GCM SDKs today to
handle notifications, and client app upgrade takes time.
But all new client-side features will be added to FCM SDKs only moving
forward. You are strongly encouraged to upgrade to FCM SDKs.
You can get more details here
As per FAQ you don't need additional server configuration when you're migrating your client app from GCM to FCM, so just use FCM in your android app.
Here's the docs on how to migrate your app
I find the problem to use both GCM and FCM together. You will get to different deviceToken and one of these token get NotRegistered error.
For my FCM token always get NotRegistered error but the app is active and not uninstalled and my GCM token is valid and gets a push notification.

Is it mandatory to use GCM service to show push notification?

I am developing a Cordova app having a Java backend. I want to know if it's mandatory to use GCM service in order to show a push notification in Android/iOS (in notification tray)?
I am using Apache Kafka, MQTT brokers in my backend. Is it possible to show push notification using these solutions, i.e. using completely self defined solutions?
Using MQTT & other brokers I am able to send realtime data to users but how to show those message as native notification in notification bar is my problem.
Yes, you will need to use GCM to send push notifications to Android devices. You can even use GCM to send push notifications to iOS devices (GCM makes request to APNS (Apple push notification service) to make it work).
But GCM for iOS isnt trusted much.
You can use any backend to send push notification to your devices. You just need to make a request to GCM/APNS.
This is the cordova plugin for push notification.
Integrating with GCM is damn easy, but it takes a little effort with APNS.
Most people use third party paid services like Pushwoosh to implement their push backend because its convenient. There is a free alternative OneSignal but it tracks your usage.
Follow this guide to setup push for APNS. (You can just use the Setup certificate part from this guide, since you are not using C#)
To receive push you need use/implement GCM(and actually FCM, because of GCM deprecation)
To show notification from app it is unnecessary to implement GCM/FCM

Categories

Resources