To get technical: the data is stored on Firebase. The app reads the data from Firebase, and adds it all to an array. There is no way to tell how many items there are without reading all of them from Firebase. The app then looks at how many elements are in the array (call that number a) and then randomly chooses a number b from 1 to a. It then takes the bth element from the array, and displays it. (I know, I didn't have to store them all in an array, but it's easier that way.)
Because of the data storage method, I can add new facts very easily: I just have to go to Firebase and add the new fact to the database. Of course, my app updates as soon as I add the new data. I can also set up the app to read data from a different Firebase location, so I can easily have multiple apps with different themes. Here's a screenshot of a Minecraft-themed app, for example:
To receive updates, subscribe now!
No comments:
Post a Comment