Firebase at a glance
Realtime Database
- The Realtime Database is really just one big JSON object that you manage in realtime. This means it’s really just a tree of values.
- With a single API, the Firebase database provides your app with both the current value of the data and any updates to that data.
Authentication
Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app.
- Email & Password
- Phone numbers
- Twitter & more
Firebase Cloud Messaging
- Using FCM, you can notify a client app that new email or other data is available to sync.
- Send notification messages (2KB limit) or data messages (4KB limit).
- Distribute messages to a single device, groups of devices, or to devices subscribed to some topics.
- Send acknowledgments, chats, and other messages from devices back to the server over FCM’s reliable and battery-efficient connection channel.
react-native-fcm: https://github.com/evollu/react-native-fcm
Firebase Database Query
- Queries are created by chaining together one or more of the filter methods defined here.
-
with a Reference, you can receive data from a Query by using the on() method.
There are actually 4 different ordering functions:
-
orderByKey()
-
orderByChild(‘child’)
-
orderByValue()
- orderByPriority()
Advance querying function to further restrict data
- startAt(‘value’)
- endAt(‘value’)
-
equalTo(‘child_key’)
- limitToFirst(10)
- limitToLast(10)
Const db = firebase.database();
Const firebaseRef = db.child(‘user’);
firebaseRef.orderByChild("user").equalTo("Aditya").on("child_added", function(snapshot) {
console.log(snapshot.key);
});
firebaseRef.orderByKey().limitToFirst(10);
In SQL, the basics of querying involves two steps:
SELECT * FROM Users where Name == ‘Aditya’;
In firebase , basics of querying also follow two steps:
SELECT * FROM User LIMIT 10;
How to Store Data
Firebase Storage
- Firebase Storage is a stand-alone solution for uploading user generated content like images and videos from an iOS and Android device, as well as the Web.
- Firebase Storage is designed specifically for scale, security, and network resiliency.
- Firebase Storage uses a simple folder/file system to structure data.
var storageRef = firebase.storage.ref("folderName/file.jpg");
var fileUpload = document.getElementById("fileUpload");
fileUpload.on(‘change’, function(evt) {
var firstFile = evt.target.file[0]; // get the first file uploaded
var uploadTask = storageRef.put(firstFile);
});
Firebase TestLabs
While making apps in my college years I always used to fiddle with the screen size for different devices.Firebase test labs provide a large number of mobile test devices for this purpose.
We have Three different modes of testing
1)Instrumentation tests:
These are tests that you have written specifically to test your app, using the Espresso and UI Automator 2.0 Android test frameworks
2)Robo test:
These are for people like me who wants to relax and let the software do its job.It simulates user touch and sees how each part is functioning.
3)Game Loop test:
To support game app testing, Test Lab now includes beta support for using a "demo mode" where the game app runs while simulating the actions of a player.
GROW
Remote Config
Remote config essentially allows us to publish updates to our users immediately. Whether we wish to change the colour scheme for a screen, the layout for a particular section in our app or show promotional/seasonal options — this is completely doable using the server side parameters without the need to publish a new version.
Remote Config gives us the power to:
- Quickly and easily update our applications without the need to publish a new build to the app / play store.
- We can effortlessly set how a segment behaves or looks in our application based on the user / device that is using it.
Firebase App Indexing
To get your app's content indexed by Google, use the same URLs in your app that you use on your website and verify that you own both your app and your website. Google Search crawls the links on your website and serves them in Search results. Then, users who've installed your app on their devices go directly to the content in your app when they click on a link.
Firebase Dynamic Links
Deep Link
A deep link is a link that takes you to content. Most web links are deep links.
Dynamic Links
A modification of Deep links which are used in apps.These links allow the user to directly come to a particular location in your app.
There are 3 fundamental uses of the dynamic link.
1)Convert mobile web users to native app users
2) Increase conversion for user-to-user sharing
To convert users when your app is shared with other users you can skip the generic message which is shown when a user downloads it from the store.Instead, you can show them personalized greeting message.
3)Drive installs from the Third party
Social media, email and Sms can be used to increase your target audience.When users install they see the exact content of your campaigns
Firestore
- Firestore- It's fast
- Firestore-More intuitive
- Firestore- and important is that now you can make query with the database
Choose a Database: Cloud Firestore or Realtime Database
- Firebase-you can either sort or can filter in the database
- Firebase-the way how it stores all data and the way one fetches all data, is little bit tricky.
- Firebase-problem arises when you database is populated with a lot of data and you want to fetch only those result you are interested in.
var citiesRef = db.collection("cities");
var query = citiesRef.where("capital", "==", true);
citiesRef.where("population", ">", 100000).orderBy("population").limit(2)
var citiesRef = db.collection("cities");
citiesRef.orderBy("population").startAt(1000000)
Query with Firestore
Latest Updates in Firebase
Robo scripts
With Robo scripts, you record yourself walking through a workflow in your app, then upload that recording to the Firebase console to run in Robo tests. When you run a Robo test with a script attached, Robo first steps through your pre-scripted actions then proceeds to explore the app as usual.
Firebase Predictions
Firebase Predictions applies machine learning to your analytics data to create dynamic user groups based on your users' predicted behaviour.
A/B Testing
A/B testing can help you find the optimal wording and presentation by testing message variants on selected portions of your user base. Whether your goal is better retention or conversion on an offer, A/B testing can perform statistical analysis to determine if a message variant is outperforming the control group for your selected objective.
Firebase & Firestore
By Aditya Kumar
Firebase & Firestore
- 473