Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase with mobile apps

Is FireBase only for use on desktop browsers, or can it be used with mobile apps as well? I have a feeling it can't be used with mobile (yet).

Though Android, for example, uses the WebKit engine (and its WebView component displays HTML pages without needing a full browser, and HTML pages can be loaded into a WebView either directly through a URL or injected as a string), Android WebKit doesn't yet (to my knowledge) support WebSockets, so if FireBase uses WebSockets (and I think I read somewhere that it does), then this precludes mobile apps (at least Android - don't know about iOS).

Any other way to achieve real-time apps on mobile with FireBase? Thanks!

like image 537
Lew Avatar asked Sep 25 '12 21:09

Lew


People also ask

Can I use Firebase for a mobile app?

Firebase Authentication works across Android, iOS and the web making it a great choice when you think your user is likely to be accessing your app across different devices.

Can I host Android app on Firebase?

Adding Firebase and Google Play Services to the Android app Select the SDK Tools tab. Select Google Play services if it's not already selected. Click OK to install it. Select File > Open… and choose the firebase-android-client directory.

Do real apps use Firebase?

Is there any popular app that uses Firebase? There's nothing wrong with Firebase even for large scale apps. Unless you're talking about stuff like Firestore, large-scale apps are likely to use their own backend services for that kind of thing.

Should I use Firebase for my app?

Firebase is a good choice if you want to deploy a working product on the cloud rapidly. Plus, as mentioned, you might want to try it out if you need a backend but don't have a backend development background.


1 Answers

Firebase supports all major mobile web browsers and even works in offline mode. There is even a node.js client and REST API.

It uses the standard fallback choices when WebSockets aren't available. Check out these questions from the FAQ:

What browsers and network connections does Firebase support? The Firebase JavaScript client supports all mainstream browsers (IE 7+, Firefox, Chrome, Safari, Opera, and major mobile web browsers), and it works on any network connection. Our team has spent years building this type of software and we have put a great deal of research and effort into ensuring we can communicate in a variety of environments. We even work through proxies and on various mobile providers where other real-time technologies may fail.

What happens to my app if I lose my network connection? Firebase transparently reconnects to the Firebase servers as soon as you regain connectivity. In the meantime, all Firebase operations done locally by your app will immediately fire events, regardless of network state, so your app will continue functioning correctly. Once connectivity is reestablished, you’ll receive the appropriate set of events so that your client “catches up” with the current server state, without you having to write any custom code.

Wait, does that mean my app will automatically work in “offline mode” and recover when it comes back online? Yes, yes, it does. :-)

UPDATE Ah, here we go. I wandered about looking for the SO question where the FB team answered this directly, and my search was not in vain:

The Firebase Javascript Client maintains a real-time bidirectional connection to the server. Under the covers, this uses WebSockets whenever possible (which have no limitations with regard to cross-origin connections) and falls back to hidden-iframe-based jsonp long-polling on older browsers (which sidesteps cross-origin issues by only doing requests).

like image 128
Kato Avatar answered Oct 05 '22 16:10

Kato