: — ġ
: Ʒ Ʈ
- NoSQL json ¸ Ѵ.
[1. ⺻ ϱ]
implementation 'com.google.firebase:firebase-database:19.1.0'
build.gradle Ӽ ߰Ѵ.
- ַܼ ̵ Database ŬѴ.
- Ÿ Cloud Firestore Realtime database ⸦ ŬѴ.
- read, write true ϰ 뼳 ŬѴ.
- ȵ̵忡 Ʈ ؼ json ̸ Ͱ ä ̴.
[2. ƼƼ, xml ]
- Empty Activity ϸ xml ϵ ÿ ȴ.
- xml ش.
- AndroidManifest.xml ϵ ش. ( ƼƼ )
[3. ̽ ]
- line 18~20 ٿֱ Ѵ.
- ũ ϴ ܰ> б ⸦ ŬѴ. (ũ — https://firebase.google.com/docs/database/android/read-and-write)
- line 18 : ̽ ϰ Ҵ()ߴ.
- line 19 : ny-face ̽ ؿ message message .
- line 21 : message ؿ Hello World .
- message ö Ȯ ִ.
[4. DTO ]
ä ְ DTO(Data Transfer Object) .
- ChatData Ѵ.
[5. ]
ChatData ٰ ϴ Recycler Ͱ ʿϴ.
- ڵ带 ŸѴ.
[6. xml ]
- Ʈ LinearLayout vertical̹Ƿ Ʒ weight 1 RecyclerView height 0dp ̰, Ʒ LinearLayout horizontal ̹Ƿ weight 1 EditText width 0dp ̴.
- onBindViewHodler ƿ г Ͽ Ѵ. ( ʿ ʿ)
[7. add Լ ]
- line 104 : Ź ο ͷ ŵƴµ, ä 1Ǿ ߰ ڿ ٿ ϹǷ add ϴ ʿϴ.
- line 105 : Ͱ ԵǴ ȭ notifyItemInserted ؾ Ѵ.
- line 105 : add ϸ ä 迭 ũⰡ þǷ Ȱؾ Ѵ.
[8. ä ]
- setValue Ͽ ChatData Class ü ̴.
- line 47~50 : ̷ Ŭ ֱ ϸ ؾ ִ. 츮 ó Hello World Ʈ ̽ ־ . Ƿ Ŭ ֱ ̹ ö ִ Ʈ Ѵ.
Ŭ Ϳ ä ؾѴ.
- line 51 : dataSnapshot = ä ִ
- line 52 : 츮 ι° getValue() ̰ ȣ ȿ Ŭ ChatData Ŭ ̴.
- getValue(ChatData.class) : ٸ Ŭ ִٸ ̶ .
- line 57 : Ŭ ȯ ʼ!
[9. ư ۵ǰ ϱ]
- ä Է ư ä Ѵ.
- line 32,33 :
- line 43,44 : xml Ʈ Ī
- line 46 : ư Button_send, EditText_chat о ϹǷ Ŭ
- line 51 : ĭ ʵ null check.
[10. ߰ & ذ]
- line60~63 : Ŭ
- line 64 : Ʈ
- line 66~67 :
- line 69,70 : ̽
- line 72~75 : ä Ϳ
- line 76~80 : ʿ(END), ʿ(START) ġѴ.
̷ ϸ Ѵ.
- ʹ ʾҴ.
- : Ͱ ó ʾҴ.
ذغ.
- ʱ Ƿ line 72~75 ּóߴ.
- ͵ ϰ ٽ غҴ.
ʾҴ.
α 캸.
Ʈ ȯ ٰ .
- line 71 path line 84,85 ּó Line 82 α .
- Ͱ ƴ ( ٷ ) Ѵ.
ٽ ذغ.
- Serialzable , setValue() push() ش.
- ¦ ̷ Ȯ ִ.
- α ¦ ִ ִ.
- ּ ó Ǯ ٽ Ȯغ.
- ߰ nick1 ؼ гӰ ä .
- line 78,82 ߰ش.
[11. ο ܸ ]
ι° äù ڸ ο ܸ غ.
߰)
- ο ڰ nick1,nick2,,, ̷ ٲѴ.
- ä Ȥ ڸ α ȭ ̿Ѵٴ firebase authentication α ̿ ִ.
- ó read, write true ־ ƹ , ̸ false ٲٸ װ Ұϴ.