A tracking service with Firebase

Now, being able to track a user's motion is all well and good, but what if we wanted to track a user across applications or even multiple users at the same time? This will require us to write a server, set up a database, make a schema, and so on, which is certainly not an easy task and cannot be easily explained in just a chapter. However, what if there was an easier way? Well, there is, and again, Google comes to our rescue with Firebase.

Firebase is an excellent collection of app tools and storage services that are dead simple to use and cross-platform. We will use Firebase database, a real-time database service, to track our user's position. Open up a web browser and follow the given steps:

  1. Browse to firebase.google.com.
  2. Click on the GET STARTED button.
  3. Log in with your Google (Gmail) account. If you don't have one, yes, you will need to create one to continue.
  4. Click on the Add project button.
  5. Name your project ARCore and select your own Country/Region, as shown in the following excerpt:
Setting up the ARCore project
  1. Click on CREATE PROJECT. This will create your project and open up the Firebase Console.
  1. Click on Add Firebase to your web app, which can be found at the top of the Project Overview page. This will open up a dialog similar to the following:
Copy the setup code for your project
  1. Click on COPY. This should copy the two script tags and contents to your clipboard.
Don't worry if the keys and URLs you see are different; they should be different.
  1. Open up the spawn-at-surface.html file in your favorite text editor. Scroll down to just before the last <script> tag, the one with the big block of code. Paste the code (Ctrl + V and command + V on Mac) you copied earlier.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.176