Pizza App is a mobile application developed with Starling Framework and Feathers UI. It showcases how to use Firebase services with ActionScript to create a small social network.
It uses the following APIs and technologies:
Some of the techniques covered are:
To compile this application you require to provide your own Yelp Fusion API Key and Secret. You will also need to provide your Firebase API key which can be obtained for free on the Firebase developer console (see below), this project only works with Firebase V3 and its newer console located at https://console.firebase.google.com/
Firebase is a set of tools and services that are designed to ease the development of server side infrastructure for apps and games. You can easily and securely save and retrieve data from the cloud.
It also offers a user management service which allows your users to register an account in your app and have personalized experiences. In this app the users can upload images, post real time messages, post comments and vote on pictures.
The following Database rules are used for this app:
{
"rules": {
"images": {
"$other": {
"$views": {
".write": true
}
},
".indexOn": [
"status",
"views"
],
".read": true,
".write": "auth != null"
},
"images_comments": {
"$other": {
".indexOn": [
"timestamp"
]
},
".read": true,
".write": "auth != null"
},
"images_votes": {
"$other": {
".indexOn": [
"value"
]
},
".read": true,
".write": "auth != null"
},
"rooms": {
".read": true,
".write": false
},
"messages": {
"$other": {
".indexOn": [
"timestamp"
]
},
".read": "auth != null",
".write": "auth != null"
}
}
}
There are several nodes that contain information on the app's content:
images
contains the metadata about the uploaded images.images_comments
contains the comments of each uploaded image.images_votes
contains the votes of each uploaded image.rooms
contains the metadata of the chat rooms.messages
contains the messages of each chat room.The following rule means that we want all the childs of the node to be indexable by their timestamp. This is used to load the latest messages and comments.
"$other": {
".indexOn": [
"timestamp"
]
},
All the data from this app is dynamically generated except for the Chat Rooms.
Chat rooms JSON structure:
{
"room1": {
"description": "Yum, delicious meat.",
"image": "assets/rooms/room1.png",
"internal_id": 1,
"name": "Meat Lovers"
},
"room2": {
"description": "Don't like meat? No problem!",
"image": "assets/rooms/room2.png",
"internal_id": 2,
"name": "Veggie Lovers"
},
"room3": {
"description": "Everyone loves cheese, right?",
"image": "assets/rooms/room3.png",
"internal_id": 3,
"name": "Cheese Lovers"
}
}
The following Storage rules are used for this app:
service firebase.storage {
match /b/<YOUR-PROJECT-ID>.appspot.com/o {
match /images/{allPaths=**} {
allow read;
allow write: if request.auth != null;
}
}
}
These rules mean that any user can download the pictures and their respective thumbnails but only registered users are able to create them.
Follow these steps to locate your Firebase API Key:
Android
, iOS
or Web
.Web
, a popup will appear.apiKey
from the JavaScript code block.Constants.as
file and set your variables and constants accordingly.Don't forget to enable Google, Facebook and Twitter authentication from the Auth section in the Firebase console.
You can test this app by downloading it directly from Google Play.