....please advise me what to do so that the service never stops in the background? (In all versions of Android)
Don't we create a service in B4A when using Firebase? So how is that service always active and receiving information in the background?
An important concept that I think you might be misunderstanding is that with the apps that you mention, they aren't "always active and receiving in the background". They are typically NOT running in the background. But they "come to life" when a push (FCM) message is received, they then start to run and handle that incoming data.
So, for your app to "receive" data in the background, your app will either:
1) Have to continuously "poll" some remote server on a regular basis to "check" to see if there is any new data to download (but with this method android might kill your app to save battery), or
2) Be configured to use FCM and then android will run your service when an incoming push message is received so it act upon it (this is the method those apps use).