Test project
You are expected to implement a small chat application.
- It has a chat message list
- It has an edit text view
- It will append the new text to the list upon submit
- Follow installation steps https://www.firebase.com/docs/android/quickstart.html
- Firebase reference is https://mysquar-test.firebaseio.com/chat
- Compile and run the project to make sure the integration is correct
- For each message submitted in step #1, it should also be saved to Firebase
- Save data to Firebase https://www.firebase.com/docs/web/guide/saving-data.html
- Use
Getting the Unique ID Generated by push()
- Data structure should look like this:
{
"chat": {
$messageId1: "Message 1",
$messageId2: "Message 2"
}
}
- Read data from Firebase https://www.firebase.com/docs/android/guide/retrieving-data.html
- Should use
Child Added
event type, as the messages are saved in a list - Compile and run the app on 2 devices to test the real-time chat
- Generate a unique user name,
"USER_<UNIQUE_4_DIGITS_NUMBER>"
- Change data structure to support user name
{
"chat": {
$messageId1: {
"username": "USER_1234",
"message": "Message 1",
},
$messageId2: {
"username": "USER_5678",
"message": "Message 2",
}
}
}
- Chat messages after being synced from Firebase should be cached locally with SQlite
- Should not use
Firebase.getDefaultConfig().setPersistenceEnabled(true);
as it is not stable - Can use any kind of ORM in Android