Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebaseを利用したAndroidアプリ開発実践入門

 Firebaseを利用したAndroidアプリ開発実践入門

Firebaseを利用したAndroidアプリ開発実践入門

3cca191bf3064fd059ea2c3d6022afbd?s=128

Fumihiko Shiroyama

October 09, 2016
Tweet

Transcript

  1. 'JSFCBTF׾ⵃ欽׃׋ "OESPJE،فٔꟚ涪 㹋騧ⰅꟌ 涯㿊俑䕕 !GVTIJSPZBNB

  2. 荈䊹稱➜ 涯㿊俑䕕 /JLLFJ*OD "OESPJE"QQ&OHJOFFS 馯㄂䧄㘋ծ㶨肪ג ս鸬鯹վأوم،فٔꟚ涪׾⸇鸞ׅ׷ 'JSFCBTF׾⢪׏ג׫״ֲ IUUQHJIZPKQEFWTFSJBMGJSFCBTF

  3. 劤傈ך،آؑٝت ˖ 'JSFCBTFך嚊銲ֶׁ׵ְ ˖ رٌ،فٔ稱➜ ˖ "VUIFOUJDBUJPO ˖ 3FBMUJNF%BUBCBTF ˖

    4UPSBHF ˖ 3FNPUF$POGJH ˖ ׉ך➭5JQT
  4. 'JSFCBTFך嚊銲ֶׁ׵ְ

  5. 'JSFCBTFך嚊銲ֶׁ׵ְ

  6. 'JSFCBTFך嚊銲ֶׁ׵ְ

  7. 'JSFCBTFך嚊銲ֶׁ׵ְ ˖ (PPHMF*0דًآٍ٦،حفر٦ز ˖ 窟さٌغ؎ٕفٓحزؿؓ٦يפה鹌⻉ ˖ "OBMZUJDT׾⚥呌ה׃גׁתׂתז؟٦ؽ أָ埆鯥ד鸬䵿

  8. 'JSFCBTFך嚊銲ֶׁ׵ְ ˖ (PPHMF*0דًآٍ٦،حفر٦ز ˖ 窟さٌغ؎ٕفٓحزؿؓ٦يפה鹌⻉ ˖ "OBMZUJDT׾⚥呌ה׃גׁתׂתז؟٦ؽ أָ埆鯥ד鸬䵿 劤傈כ'JSFCBTFך醱侧ך؟٦ؽأ׾⢪ְז ָ׵㹋騧涸ז"OESPJE،فٔך⡲׶倯׾稱

    ➜׃תׅ
  9. رٌ،فٔ稱➜

  10. رٌ،فٔ稱➜ ׻ְ׻ְثٍحز IUUQTQMBZHPPHMFDPNTUPSFBQQT EFUBJMT JEVTTIJSPZBNBBOESPJEGJSFCBTFSFBMUJNFDIBU ˖ ٔ،ٕة؎يثٍحز ˖ 5XJUUFS钠鏾 ˖

    ًحإ٦آך鷏⥋ ˖ 歗⫷ך،حفٗ٦س ˖ 荈ⴓך鷏׏׋ًحإ٦آך⵴ꤐ ˖ 荈ⴓך鷏׏׋歗⫷ך⵴ꤐ IUUQTHJUIVCDPNTSZN'JSFCBTF3FBM5JNF$IBU
  11. رٌ،فٔ稱➜

  12. 'JSFCBTF4%,

  13. // Top-level build file
 
 buildscript {
 repositories {
 jcenter()


    mavenCentral()
 }
 dependencies {
 classpath 'com.google.gms:google-services:3.0.0'
 }
 } فٗآؙؑزךCVJMEHSBEMF
  14. def firebase_lib_version = '9.6.1'
 
 dependencies {
 compile fileTree(dir: 'libs',

    include: ['*.jar'])
 
 compile "com.google.firebase:firebase-core:${firebase_lib_version}"
 }
 
 // THIS MUST BE AT THE BOTTOM
 apply plugin: 'com.google.gms.google-services' ،فٌٔآُ٦ٕךCVJMEHSBEMF
  15. def firebase_lib_version = '9.6.1'
 
 dependencies {
 compile fileTree(dir: 'libs',

    include: ['*.jar'])
 
 compile "com.google.firebase:firebase-core:${firebase_lib_version}"
 }
 
 // THIS MUST BE AT THE BOTTOM
 apply plugin: 'com.google.gms.google-services' ،فٌٔآُ٦ٕךCVJMEHSBEMF
  16. "VUIFOUJDBUJPO

  17. "VUIFOUJDBUJPO ˖ 'JSFCBTFך钠鏾㛇湍 ˖ 'JSFCBTF荈魦ָ*%1"44ח״׷钠鏾堣圓׾䭯׏ג ְ׷➭ծ(PPHMF 'BDFCPPL 5XJUUFS (JU)VCזו ך،ؕؐٝزד钠鏾דֹ׷

    ˖ ⼡せךٙٝة؎ي钠鏾 ˖ 醱侧钠鏾فٗغ؎تך钠鏾䞔㜠ך窟さ ˖ ׻ְ׻ְثٍحزדכ5XJUUFS钠鏾׾ⵃ欽׃תׅ
  18. "VUIFOUJDBUJPO

  19. "VUIFOUJDBUJPO

  20. "VUIFOUJDBUJPO

  21. "VUIFOUJDBUJPO

  22. "VUIFOUJDBUJPO

  23. "VUIFOUJDBUJPO

  24. "VUIFOUJDBUJPO ˖ BQQTUXJUUFSDPN ˖ $SFBUF/FX"QQ

  25. "VUIFOUJDBUJPO ˖ BQQTUXJUUFSDPN ˖ $SFBUF/FX"QQ

  26. "VUIFOUJDBUJPO

  27. "VUIFOUJDBUJPO

  28. "VUIFOUJDBUJPO

  29. "VUIFOUJDBUJPO

  30. def firebase_lib_version = '9.6.1'
 
 dependencies {
 compile "com.google.firebase:firebase-core:${firebase_lib_version}" compile

    "com.google.firebase:firebase-auth:${firebase_lib_version}"
 }
 
 // THIS MUST BE AT THE BOTTOM
 apply plugin: 'com.google.gms.google-services' ،فٌٔآُ٦ٕךCVJMEHSBEMF
  31. "VUIFOUJDBUJPO "OESPJE4UVEJP

  32. public class MyApplication extends Application {
 public ApplicationComponent applicationComponent;
 


    @Override
 public void onCreate() {
 super.onCreate();
 
 TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.TWITTER_KEY, BuildConfig.TWITTER_SECRET);
 Fabric.with(this, new Twitter(authConfig), new Crashlytics());
 }
 
 }
  33. public class MyApplication extends Application {
 public ApplicationComponent applicationComponent;
 


    @Override
 public void onCreate() {
 super.onCreate();
 
 TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.TWITTER_KEY, BuildConfig.TWITTER_SECRET);
 Fabric.with(this, new Twitter(authConfig), new Crashlytics());
 }
 
 } "1*,FZ 4FDSFU
  34. <RelativeLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 
 <com.twitter.sdk.android.core.identity.TwitterLoginButton
 android:id="@+id/twitter_login_button"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerInParent="true" />


    
 </RelativeLayout>
  35. <RelativeLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 
 <com.twitter.sdk.android.core.identity.TwitterLoginButton
 android:id="@+id/twitter_login_button"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerInParent="true" />


    
 </RelativeLayout> 5XJUUFSؚٗ؎ٝنةٝ
  36. @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {


    twitterLoginButton.onActivityResult(requestCode, resultCode, data);
 }
  37. @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {


    twitterLoginButton.onActivityResult(requestCode, resultCode, data);
 } 钠鏾䖓؝٦ٕغحؙ
  38. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 });
  39. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 }); ؙٔحؙ
  40. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 }); 5XJUUFSךز٦ؙٝ
  41. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 }); 'JSFCBTFך钠鏾彊⪒
  42. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 }); 'JSFCBTFחؚٗ؎ٝ
  43. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 }); 'JSFCBTFⰻךِ٦ؠ
  44. twitterLoginButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 TwitterSession

    session = result.data;
 TwitterAuthToken token = session.getAuthToken();
 AuthCredential credential = TwitterAuthProvider.getCredential(token.token, token.secret);
 
 FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
 firebaseAuth.signInWithCredential(credential)
 .addOnSuccessListener(authResult -> {
 FirebaseUser firebaseUser = authResult.getUser();
 String uid = firebaseUser.getUid();
 UserInfo twitterUser = firebaseUser.getProviderData().get(1);
 String name = twitterUser.getDisplayName();
 String thumbnail = twitterUser.getPhotoUrl().toString();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 }
 
 @Override
 public void failure(TwitterException exception) {
 }
 }); ♧䠐ז*%
  45. if (firebaseAuth.getCurrentUser() != null) {
 FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
 String

    uid = firebaseUser.getUid();
 }
  46. if (firebaseAuth.getCurrentUser() != null) {
 FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
 String

    uid = firebaseUser.getUid();
 } ؚٗ؎ٝ幥׫
  47. @Override
 public boolean onOptionsItemSelected(MenuItem item) {
 switch (item.getItemId()) {
 case

    R.id.action_logout:
 firebaseAuth.signOut();
 return true;
 default:
 return super.onOptionsItemSelected(item);
 }
 }
  48. @Override
 public boolean onOptionsItemSelected(MenuItem item) {
 switch (item.getItemId()) {
 case

    R.id.action_logout:
 firebaseAuth.signOut();
 return true;
 default:
 return super.onOptionsItemSelected(item);
 }
 } ؚٗ،ؐز
  49. "VUIFOUJDBUJPO ˖ 钠鏾فٗغ؎تח״׏ג《䖤דֹ׷䞔㜠ח蕯䎁ך 䊴殯ָ֮׷ָծ㛇劤涸ז⢪ְ倯כ➭ךفٗغ؎ت ׮ずׄ ˖ 'JSFBCBTF6TFSHFU6JE ד《䖤דֹ׷6*%כفٗ غ؎ت׾ת׋ְד׮窫㼎חꅾ醱׃זְ♧䠐ד֮ ׷ֿהָ⥂鏾ׁ׸גְ׷

    ˖ 6*ה钠鏾Ⳣ椚ָמהאחז׏׋'JSFBCBTF6* ك٦ةהְֲך׮֮׷
  50. 3FBMUJNF%BUBCBTF

  51. 3FBMUJNF%BUBCBTF ˖ ٔ،ٕة؎يחず劍ׁ׸׷ر٦ةك٦أ ˖ أؗ٦وٖأז/P42- ˖ ر٦ةכ+40/䕎䒭ד⥂䭯 ˖ ؔؿٓ؎ٝ؟ه٦ز ˖

    "OESPJE J04 8FC ˖ 厫鮾ז،ؙإأⵖ䖴
  52. ر٦ة圓鸡 { "users": { "alovelace": { "name": "Ada Lovelace", "contacts":

    { "ghopper": true }, }, "ghopper": { ... }, "eclarke": { ... } } } +40/ד邌植דֹ׷⟣䠐ךر٦ة圓鸡
  53. ر٦ة圓鸡 劤傈䪔ֲر٦ة圓鸡 { "messages" : { "message01" : { "body"

    : "hello!", "senderUid" : "user0001", "type" : 0 }, ..... }, "users" : { "user01" : { "name" : "Steve", "thumbnail" : "http://example.com/img/user01.jpg" }, .... } }
  54. ر٦ة圓鸡 ط؎ذ؍ـדٔأزכ؟ه٦زׁ׸זְ { "messages" : { "message01" : { "body"

    : "hello!", "senderUid" : "user0001", "type" : 0 }, ..... }, "users" : { "user01" : { "name" : "Steve", "thumbnail" : "http://example.com/img/user01.jpg" }, .... } }
  55. ➙傈䠐陎׃ג妜׃ְֿה

  56. ➙傈䠐陎׃ג妜׃ְֿה

  57. ➙傈䠐陎׃ג妜׃ְֿה

  58. ر٦ة圓鸡 { "messages" : { "message01" : { "body" :

    "hello!", "senderUid" : "user0001", "type" : 0 }, "message02" : { "body" : "how are you!", "senderUid" : "user0002", "type" : 0 }, .... } }
  59. ➙傈䠐陎׃ג妜׃ְֿה

  60. ر٦ة圓鸡 { "messages" : { "message01" : { "body" :

    "hello!", "senderUid" : "user0001", "type" : 0 }, "message02" : { "body" : "how are you!", "senderUid" : "user0002", "type" : 0 }, .... } }
  61. 3FBMUJNF%BUBCBTF ˖ ؎كٝزسٔـٌٝرٕ ˖ 妜׃ְة؎ىؚٝד《׶ח遤ֻךדכזֻծ圫ղ ז؎كٝزח㼎׃גٔأش׾涫ꐮ׃גֶֹծ؎ك ٝز涪欰׀הח؝٦ٕغحؙ׃ג׮׵ֲ ˖ ر٦ةךٔؿ؋ٖٝأח㼎׃גٔأش׾鏣㹀ׅ׷ ֿ׸׵ך暴䗙׾䬃ִׁגֶֻֿהָꅾ銲

  62. ؎كٝزٔأشך珏겲 ٔأش ؎كٝز 欽鷿 7BMVF&WFOU-JTUFOFS PO%BUB$IBOHF ػأך؝ٝذٝخח㼎ׅ׷ 㢌刿儗חㄎל׸׷ $IJME&WFOU-JTUFOFS PO$IJME"EEFE

    ٔأزח㶨銲稆ָ鷄⸇ׁ׸ ׋儗חㄎל׸׷ $IJME&WFOU-JTUFOFS PO$IJME$IBOHFE ٔأزך㶨銲稆ח㢌刿ָ֮ ׏׋儗חㄎל׸׷ $IJME&WFOU-JTUFOFS PO$IJME3FNPWFE ٔأزך㶨銲稆ָ⵴ꤐׁ׸ ׋儗חㄎל׸׷ $IJME&WFOU-JTUFOFS PO$IJME.PWFE ٔأزך㶨銲稆ך갫䎷ָ㢌 ׻׏׋儗חㄎל׸׷
  63. def firebase_lib_version = '9.6.1'
 
 dependencies {
 compile "com.google.firebase:firebase-core:${firebase_lib_version}" compile

    "com.google.firebase:firebase-auth:${firebase_lib_version}" compile "com.google.firebase:firebase-database:${firebase_lib_version}"
 }
 
 // THIS MUST BE AT THE BOTTOM
 apply plugin: 'com.google.gms.google-services' ،فٌٔآُ٦ٕךCVJMEHSBEMF
  64. ر٦ةך知⽃ז铣׫剅ֹ // Write a message to the database FirebaseDatabase database

    = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef.setValue("Hello, World!");
  65. ر٦ةך知⽃ז剅ֹ鴥׫ // Write a message to the database FirebaseDatabase database

    = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef.setValue("Hello, World!"); ر٦ةك٦أפ،ؙإأׅ׷彊⪒
  66. ر٦ةך知⽃ז剅ֹ鴥׫ // Write a message to the database FirebaseDatabase database

    = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef.setValue("Hello, World!"); NFTTBHFפך⿫撑
  67. ر٦ةך知⽃ז剅ֹ鴥׫ // Write a message to the database FirebaseDatabase database

    = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef.setValue("Hello, World!"); NFTTBHF)FMMP 8PSMEה剅ֹ鴥׫
  68. ر٦ةך知⽃ז铣׫⳿׃ FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference messageRef = database.getReference("message"); ValueEventListener

    messageListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String message = dataSnapshot.getValue(String.class); } @Override public void onCancelled(DatabaseError databaseError) { } }; messageRef.addValueEventListener(messageListener); NFTTBHFפך⿫撑
  69. ر٦ةך知⽃ז铣׫⳿׃ FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference messageRef = database.getReference("message"); ValueEventListener

    messageListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String message = dataSnapshot.getValue(String.class); } @Override public void onCancelled(DatabaseError databaseError) { } }; messageRef.addValueEventListener(messageListener); 7BMVF&WFOU-JTUFOFSך⡲䧭
  70. ر٦ةך知⽃ז铣׫⳿׃ FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference messageRef = database.getReference("message"); ValueEventListener

    messageListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String message = dataSnapshot.getValue(String.class); } @Override public void onCancelled(DatabaseError databaseError) { } }; messageRef.addValueEventListener(messageListener); ر٦ةך《׶⳿׃
  71. ر٦ةך知⽃ז铣׫⳿׃ FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference messageRef = database.getReference("message"); ValueEventListener

    messageListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String message = dataSnapshot.getValue(String.class); } @Override public void onCancelled(DatabaseError databaseError) { } }; messageRef.addValueEventListener(messageListener); ٔأشך鏣㹀
  72. ׍ז׫ח˘ ٔؿ؋ٖٝأכDIJME ד⟣䠐ך 帾ׁתד䱠׏גְֻֿהָדֹ׷ private void writeNewUser(String userId, String name,

    String email) { User user = new User(name, email); mDatabase.child("users").child(userId).setValue(user); }
  73. 7BMVF&WFOU-JTUFOFS ValueEventListener postListener = new ValueEventListener() { @Override public void

    onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Post post = dataSnapshot.getValue(Post.class); // ... } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // ... } }; mPostReference.addValueEventListener(postListener);
  74. 7BMVF&WFOU-JTUFOFS ValueEventListener postListener = new ValueEventListener() { @Override public void

    onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Post post = dataSnapshot.getValue(Post.class); // ... } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // ... } }; mPostReference.addValueEventListener(postListener);
  75. 7BMVF&WFOU-JTUFOFS ValueEventListener postListener = new ValueEventListener() { @Override public void

    onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Post post = dataSnapshot.getValue(Post.class); // ... } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // ... } }; mPostReference.addValueEventListener(postListener);
  76. 7BMVF&WFOU-JTUFOFS ValueEventListener postListener = new ValueEventListener() { @Override public void

    onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Post post = dataSnapshot.getValue(Post.class); // ... } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // ... } }; mPostReference.addValueEventListener(postListener);
  77. 7BMVF&WFOU-JTUFOFS ValueEventListener postListener = new ValueEventListener() { @Override public void

    onDataChange(DataSnapshot dataSnapshot) { // Get Post object and use the values to update the UI Post post = dataSnapshot.getValue(Post.class); // ... } @Override public void onCancelled(DatabaseError databaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); // ... } }; mPostReference.addValueEventListener(postListener); ⥂㶷׮铣׫⳿׃׮⟣䠐ך10+0ָ⢪欽〳腉
  78. $IJME&WFOU-JTUFOFS ChildEventListener childEventListener = new ChildEventListener() { @Override public void

    onChildAdded(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildAdded:" + dataSnapshot.getKey()); // A new comment has been added, add it to the displayed list Comment comment = dataSnapshot.getValue(Comment.class); // ... }
  79. $IJME&WFOU-JTUFOFS ChildEventListener childEventListener = new ChildEventListener() { @Override public void

    onChildAdded(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildAdded:" + dataSnapshot.getKey()); // A new comment has been added, add it to the displayed list Comment comment = dataSnapshot.getValue(Comment.class); // ... } PO$IJME"EEFE כ㶨銲稆ך鷄⸇
  80. $IJME&WFOU-JTUFOFS @Override public void onChildChanged(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG,

    "onChildChanged:" + dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so displayed the changed comment. Comment newComment = dataSnapshot.getValue(Comment.class); String commentKey = dataSnapshot.getKey(); // ... }
  81. $IJME&WFOU-JTUFOFS @Override public void onChildChanged(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG,

    "onChildChanged:" + dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so displayed the changed comment. Comment newComment = dataSnapshot.getValue(Comment.class); String commentKey = dataSnapshot.getKey(); // ... } PO$IJME$IBOHFE כ㶨銲稆ך㢌⻉
  82. $IJME&WFOU-JTUFOFS @Override public void onChildRemoved(DataSnapshot dataSnapshot) { Log.d(TAG, "onChildRemoved:" +

    dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so remove it. String commentKey = dataSnapshot.getKey(); // ... }
  83. $IJME&WFOU-JTUFOFS @Override public void onChildRemoved(DataSnapshot dataSnapshot) { Log.d(TAG, "onChildRemoved:" +

    dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so remove it. String commentKey = dataSnapshot.getKey(); // ... } PO$IJME3FNPWFE כ㶨銲稆ך⵴ꤐ
  84. $IJME&WFOU-JTUFOFS @Override public void onChildMoved(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG,

    "onChildMoved:" + dataSnapshot.getKey()); // A comment has changed position, use the key to determine if we are // displaying this comment and if so move it. Comment movedComment = dataSnapshot.getValue(Comment.class); String commentKey = dataSnapshot.getKey(); // ... }
  85. $IJME&WFOU-JTUFOFS @Override public void onChildMoved(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG,

    "onChildMoved:" + dataSnapshot.getKey()); // A comment has changed position, use the key to determine if we are // displaying this comment and if so move it. Comment movedComment = dataSnapshot.getValue(Comment.class); String commentKey = dataSnapshot.getKey(); // ... } PO$IJME.PWFE כ㶨銲稆ך갫殢Ⰵ剏
  86. $IJME&WFOU-JTUFOFS @Override public void onCancelled(DatabaseError databaseError) { Log.w(TAG, "postComments:onCancelled", databaseError.toException());

    Toast.makeText(mContext, "Failed to load comments.", Toast.LENGTH_SHORT).show(); } }; ref.addChildEventListener(childEventListener);
  87. $IJME&WFOU-JTUFOFS @Override public void onCancelled(DatabaseError databaseError) { Log.w(TAG, "postComments:onCancelled", databaseError.toException());

    Toast.makeText(mContext, "Failed to load comments.", Toast.LENGTH_SHORT).show(); } }; ref.addChildEventListener(childEventListener); BEE$IJME&WFOU-JTUFOFSחإحز 埄ꣲךؒٓ٦瘝
  88. ٔأزח㶨銲稆׾鷄⸇ DatabaseReference newMessageRef = databaseReference.child("/messages").push();
 
 newMessageRef
 .setValue(message)
 .addOnSuccessListener(result ->

    Log.d(TAG, "try message send."))
 .addOnFailureListener(error -> handleError(error, R.string.message_sent_error));
  89. ٔأزח㶨銲稆׾鷄⸇ DatabaseReference newMessageRef = databaseReference.child("/messages").push();
 
 newMessageRef
 .setValue(message)
 .addOnSuccessListener(result ->

    Log.d(TAG, "try message send."))
 .addOnFailureListener(error -> handleError(error, R.string.message_sent_error)); QVTI דة؎يأةٝفח㛇בֻLFZָ荈⹛涪遤ׁ׸׷
  90. ٔأزח㶨銲稆׾鷄⸇ DatabaseReference newMessageRef = databaseReference.child("/messages").push();
 
 newMessageRef
 .setValue(message)
 .addOnSuccessListener(result ->

    Log.d(TAG, "try message send."))
 .addOnFailureListener(error -> handleError(error, R.string.message_sent_error)); ֮הכֿ׸תדず圫TFU7BMVFׅ׷׌ֽ
  91. 銲稆ך⚛ן剏ִ ًاحس 欽鷿 PSEFS#Z$IJME 䭷㹀׃׋㶨銲稆ך⦼׾׮הח⚛ן剏ִ PSEFS#Z,FZ 㶨銲稆ךؗ٦׾׮הח⚛ן剏ִ PSEFS#Z7BMVF 㶨銲稆荈魦ך⦼׾׮הח⚛ן剏ִ PSEFS#Z1SJPSJUZ

    ⮚⯓䏝׾׮הח⚛ן剏ִ
  92. 銲稆ך⚛ן剏ִ String myUserId = getUid(); Query myTopPostsQuery = databaseReference.child("user-posts").child(myUserId) .orderByChild("starCount");

    myTopPostsQuery.addChildEventListener(new ChildEventListener() { // TODO: implement the ChildEventListener methods as documented above // ... });
  93. 銲稆ך⚛ן剏ִ String myUserId = getUid(); Query myTopPostsQuery = databaseReference.child("user-posts").child(myUserId) .orderByChild("starCount");

    myTopPostsQuery.addChildEventListener(new ChildEventListener() { // TODO: implement the ChildEventListener methods as documented above // ... }); ⟣䠐ךٔؿ؋ٖٝأ׾⿫撑
  94. 銲稆ך⚛ן剏ִ String myUserId = getUid(); Query myTopPostsQuery = databaseReference.child("user-posts").child(myUserId) .orderByChild("starCount");

    myTopPostsQuery.addChildEventListener(new ChildEventListener() { // TODO: implement the ChildEventListener methods as documented above // ... }); ا٦ز勴⟝׾䭷㹀
  95. 銲稆ך⚛ן剏ִ String myUserId = getUid(); Query myTopPostsQuery = databaseReference.child("user-posts").child(myUserId) .orderByChild("starCount");

    myTopPostsQuery.addChildEventListener(new ChildEventListener() { // TODO: implement the ChildEventListener methods as documented above // ... }); ֿ׸תד鸐׶ٔأش׾إحز
  96. 銲稆ךؿ؍ٕة ًاحس 欽鷿 MJNJU5P'JSTU ⯓걧ַ׵O⟝《䖤 MJNJU5P-BTU 䖓倯ַ׵O⟝《䖤 TUBSU"U 勴⟝חوحثׅ׷⦼⟃꣬׾《䖤 FOE"U

    勴⟝חوحثׅ׷⦼תד׾《䖤 FRVBM5P 勴⟝חوحثׅ׷⦼׾《䖤
  97. 銲稆ךؿ؍ٕة Query recentPostsQuery = databaseReference.child("posts") ɹɹɹɹɹ.orderByChild("starCount") .startAt(5) .limitToFirst(100);

  98. 銲稆ךؿ؍ٕة Query recentPostsQuery = databaseReference.child("posts") ɹɹɹɹɹ.orderByChild("starCount") .startAt(5) .limitToFirst(100);

  99. 銲稆ךؿ؍ٕة Query recentPostsQuery = databaseReference.child("posts") ɹɹɹɹɹ.orderByChild("starCount") .startAt(5) .limitToFirst(100); ا٦زה穈׫さ׻ׇ׷ֿה׮ծ⟣䠐ךؿ؍ٕةה♧筰ח ⢪ֲֿה׮דֹ׷

  100. 4UPSBHF

  101. 4UPSBHF ˖ (PPHMF$MPVE4UPSBHFךغ؛حز׾ⵃ欽׃׋غ؎ شٔر٦ة׾知⽃ַאإُؗ،ח䪔ֲֿהךדֹ ׷➬穈׫ ˖ 3FBMUJNF%BUBCBTFכأزٖ٦آָ넝⣣זךדծ ׉ֿח歗⫷ؿ؋؎ٕ瘝׾縧ֻֿהכ֮ת׶植㹋涸 דכזְ ˖

    ٔؿ؋ٖٝأך➬穈׫瘝כ3FBMUJNF%BUBCBTFח ״ֻ⡂גֶ׶ꬊ䌢ח知⽃ח䪔ֲֿהָ〳腉
  102. 4UPSBHF

  103. 4UPSBHF

  104. def firebase_lib_version = '9.6.1'
 
 dependencies {
 compile "com.google.firebase:firebase-core:${firebase_lib_version}" compile

    "com.google.firebase:firebase-auth:${firebase_lib_version}" compile "com.google.firebase:firebase-storage:${firebase_lib_version}"
 }
 
 // THIS MUST BE AT THE BOTTOM
 apply plugin: 'com.google.gms.google-services' ،فٌٔآُ٦ٕךCVJMEHSBEMF
  105. 4UPSBHF FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>"); StorageReference

    imagesRef = storageRef.child("images"); StorageReference spaceRef = storageRef.child("images/space.jpg"); spaceRef.getPath(); spaceRef.getName(); spaceRef.getBucket();
  106. 4UPSBHF FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>"); StorageReference

    imagesRef = storageRef.child("images"); StorageReference spaceRef = storageRef.child("images/space.jpg"); spaceRef.getPath(); spaceRef.getName(); spaceRef.getBucket();
  107. 4UPSBHF FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>"); StorageReference

    imagesRef = storageRef.child("images"); StorageReference spaceRef = storageRef.child("images/space.jpg"); spaceRef.getPath(); spaceRef.getName(); spaceRef.getBucket();
  108. 4UPSBHF FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>"); StorageReference

    imagesRef = storageRef.child("images"); StorageReference spaceRef = storageRef.child("images/space.jpg"); spaceRef.getPath(); spaceRef.getName(); spaceRef.getBucket();
  109. 4UPSBHF FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>"); StorageReference

    imagesRef = storageRef.child("images"); StorageReference spaceRef = storageRef.child("images/space.jpg"); spaceRef.getPath(); spaceRef.getName(); spaceRef.getBucket();
  110. 4UPSBHFח،حفٗ٦س public void uploadImage(String filePath, boolean deletePath) {
 String fileName

    = UUID.randomUUID().toString();
 StorageReference target = storageReference
 .child(IMG_DIR)
 .child(fileName);
 
 try {
 InputStream inputStream = new BufferedInputStream(new FileInputStream(filePath));
 target.putStream(inputStream)
 .addOnSuccessListener(taskSnapshot -> {
 Log.d(TAG, "upload succeeded.");
 long totalBytes = taskSnapshot.getTotalByteCount();
 Uri downloadUri = taskSnapshot.getDownloadUrl();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 } catch (FileNotFoundException e) {
 Log.e(TAG, e.getMessage(), e);
 }
 }
  111. 4UPSBHFח،حفٗ٦س public void uploadImage(String filePath, boolean deletePath) {
 String fileName

    = UUID.randomUUID().toString();
 StorageReference target = storageReference
 .child(IMG_DIR)
 .child(fileName);
 
 try {
 InputStream inputStream = new BufferedInputStream(new FileInputStream(filePath));
 target.putStream(inputStream)
 .addOnSuccessListener(taskSnapshot -> {
 Log.d(TAG, "upload succeeded.");
 long totalBytes = taskSnapshot.getTotalByteCount();
 Uri downloadUri = taskSnapshot.getDownloadUrl();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 } catch (FileNotFoundException e) {
 Log.e(TAG, e.getMessage(), e);
 }
 }
  112. 4UPSBHFח،حفٗ٦س public void uploadImage(String filePath, boolean deletePath) {
 String fileName

    = UUID.randomUUID().toString();
 StorageReference target = storageReference
 .child(IMG_DIR)
 .child(fileName);
 
 try {
 InputStream inputStream = new BufferedInputStream(new FileInputStream(filePath));
 target.putStream(inputStream)
 .addOnSuccessListener(taskSnapshot -> {
 Log.d(TAG, "upload succeeded.");
 long totalBytes = taskSnapshot.getTotalByteCount();
 Uri downloadUri = taskSnapshot.getDownloadUrl();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 } catch (FileNotFoundException e) {
 Log.e(TAG, e.getMessage(), e);
 }
 }
  113. 4UPSBHFח،حفٗ٦س public void uploadImage(String filePath, boolean deletePath) {
 String fileName

    = UUID.randomUUID().toString();
 StorageReference target = storageReference
 .child(IMG_DIR)
 .child(fileName);
 
 try {
 InputStream inputStream = new BufferedInputStream(new FileInputStream(filePath));
 target.putStream(inputStream)
 .addOnSuccessListener(taskSnapshot -> {
 Log.d(TAG, "upload succeeded.");
 long totalBytes = taskSnapshot.getTotalByteCount();
 Uri downloadUri = taskSnapshot.getDownloadUrl();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 } catch (FileNotFoundException e) {
 Log.e(TAG, e.getMessage(), e);
 }
 }
  114. 4UPSBHFח،حفٗ٦س public void uploadImage(String filePath, boolean deletePath) {
 String fileName

    = UUID.randomUUID().toString();
 StorageReference target = storageReference
 .child(IMG_DIR)
 .child(fileName);
 
 try {
 InputStream inputStream = new BufferedInputStream(new FileInputStream(filePath));
 target.putStream(inputStream)
 .addOnSuccessListener(taskSnapshot -> {
 Log.d(TAG, "upload succeeded.");
 long totalBytes = taskSnapshot.getTotalByteCount();
 Uri downloadUri = taskSnapshot.getDownloadUrl();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 } catch (FileNotFoundException e) {
 Log.e(TAG, e.getMessage(), e);
 }
 }
  115. 4UPSBHFח،حفٗ٦س public void uploadImage(String filePath, boolean deletePath) {
 String fileName

    = UUID.randomUUID().toString();
 StorageReference target = storageReference
 .child(IMG_DIR)
 .child(fileName);
 
 try {
 InputStream inputStream = new BufferedInputStream(new FileInputStream(filePath));
 target.putStream(inputStream)
 .addOnSuccessListener(taskSnapshot -> {
 Log.d(TAG, "upload succeeded.");
 long totalBytes = taskSnapshot.getTotalByteCount();
 Uri downloadUri = taskSnapshot.getDownloadUrl();
 })
 .addOnFailureListener(e -> Log.e(TAG, e.getMessage(), e));
 } catch (FileNotFoundException e) {
 Log.e(TAG, e.getMessage(), e);
 }
 } ؙٓ؎،ٝزכֿ׸׾تؐٝٗ٦س
  116. 4UPSBHFַ׵⵴ꤐ public void deleteImage(String fileName) {
 StorageReference target = storageReference


    .child(IMG_DIR)
 .child(fileName);
 target.delete()
 .addOnSuccessListener(result -> Log.d(TAG, "image delete ok."))
 .addOnFailureListener(error -> Log.e(TAG, error.getMessage(), error));
 }
  117. 4UPSBHFַ׵⵴ꤐ public void deleteImage(String fileName) {
 StorageReference target = storageReference


    .child(IMG_DIR)
 .child(fileName);
 target.delete()
 .addOnSuccessListener(result -> Log.d(TAG, "image delete ok."))
 .addOnFailureListener(error -> Log.e(TAG, error.getMessage(), error));
 }
  118. 4UPSBHFַ׵⵴ꤐ public void deleteImage(String fileName) {
 StorageReference target = storageReference


    .child(IMG_DIR)
 .child(fileName);
 target.delete()
 .addOnSuccessListener(result -> Log.d(TAG, "image delete ok."))
 .addOnFailureListener(error -> Log.e(TAG, error.getMessage(), error));
 }
  119. 4UPSBHFַ׵⵴ꤐ public void deleteImage(String fileName) {
 StorageReference target = storageReference


    .child(IMG_DIR)
 .child(fileName);
 target.delete()
 .addOnSuccessListener(result -> Log.d(TAG, "image delete ok."))
 .addOnFailureListener(error -> Log.e(TAG, error.getMessage(), error));
 }
  120. 3FNPUF$POGJH

  121. 3FNPUF$POGJH ˖ "#ذأزזו׾ꬊ䌢ח知⽃ח遤ֲ➬穈׫ ˖ "#ذأز⟃㢩ח׮㕂ח״׷؝ٝذٝخ⳿׃ⴓ ֽծؙٓ؎،ٝزךٔٔ٦أז׃ח俑鎉ך䊴׃剏 ִזו ˖ ؔٝٓ؎ٝ,FZ7BMVF4UPSFך״ֲז׮ך׌ָծ طحزꬊ䱸竲儗ח׮ؒٓ٦搀ֻⵃ欽〳腉

  122. 3FNPUF$POGJH

  123. 3FNPUF$POGJH

  124. 3FNPUF$POGJH

  125. 3FNPUF$POGJH

  126. 3FNPUF$POGJH

  127. def firebase_lib_version = '9.6.1'
 
 dependencies {
 compile "com.google.firebase:firebase-core:${firebase_lib_version}" compile

    "com.google.firebase:firebase-auth:${firebase_lib_version}" compile "com.google.firebase:firebase-storage:${firebase_lib_version}" compile "com.google.firebase:firebase-config:${firebase_lib_version}"
 }
 
 // THIS MUST BE AT THE BOTTOM
 apply plugin: 'com.google.gms.google-services' ،فٌٔآُ٦ٕךCVJMEHSBEMF
  128. 3FNPUF$POGJH

  129. 3FNPUF$POGJH <?xml version="1.0" encoding="utf-8"?>
 <defaultsMap>
 <entry>
 <key>chat_bg_color</key>
 <value>#87ceeb</value>
 </entry>
 </defaultsMap>

  130. 3FNPUF$POGJH <?xml version="1.0" encoding="utf-8"?>
 <defaultsMap>
 <entry>
 <key>chat_bg_color</key>
 <value>#87ceeb</value>
 </entry>
 </defaultsMap>

  131. 3FNPUF$POGJH FirebaseRemoteConfigSettings remoteConfigSettings = new FirebaseRemoteConfigSettings.Builder()
 .setDeveloperModeEnabled(BuildConfig.DEBUG)
 .build();
 
 FirebaseRemoteConfig

    firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
 firebaseRemoteConfig.setConfigSettings(remoteConfigSettings);
 firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
 
 if (firebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
 cacheExpiration = 0;
 }
 
 firebaseRemoteConfig.fetch(cacheExpiration)
 .addOnSuccessListener(result -> Log.d(TAG, "Fetch succeeded."))
 .addOnFailureListener(e -> Log.e(TAG, "Fetch failed.", e));
  132. 3FNPUF$POGJH FirebaseRemoteConfigSettings remoteConfigSettings = new FirebaseRemoteConfigSettings.Builder()
 .setDeveloperModeEnabled(BuildConfig.DEBUG)
 .build();
 
 FirebaseRemoteConfig

    firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
 firebaseRemoteConfig.setConfigSettings(remoteConfigSettings);
 firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
 
 if (firebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
 cacheExpiration = 0;
 }
 
 firebaseRemoteConfig.fetch(cacheExpiration)
 .addOnSuccessListener(result -> Log.d(TAG, "Fetch succeeded."))
 .addOnFailureListener(e -> Log.e(TAG, "Fetch failed.", e));
  133. 3FNPUF$POGJH FirebaseRemoteConfigSettings remoteConfigSettings = new FirebaseRemoteConfigSettings.Builder()
 .setDeveloperModeEnabled(BuildConfig.DEBUG)
 .build();
 
 FirebaseRemoteConfig

    firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
 firebaseRemoteConfig.setConfigSettings(remoteConfigSettings);
 firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
 
 if (firebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
 cacheExpiration = 0;
 }
 
 firebaseRemoteConfig.fetch(cacheExpiration)
 .addOnSuccessListener(result -> Log.d(TAG, "Fetch succeeded."))
 .addOnFailureListener(e -> Log.e(TAG, "Fetch failed.", e));
  134. 3FNPUF$POGJH FirebaseRemoteConfigSettings remoteConfigSettings = new FirebaseRemoteConfigSettings.Builder()
 .setDeveloperModeEnabled(BuildConfig.DEBUG)
 .build();
 
 FirebaseRemoteConfig

    firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
 firebaseRemoteConfig.setConfigSettings(remoteConfigSettings);
 firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
 
 if (firebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
 cacheExpiration = 0;
 }
 
 firebaseRemoteConfig.fetch(cacheExpiration)
 .addOnSuccessListener(result -> Log.d(TAG, "Fetch succeeded."))
 .addOnFailureListener(e -> Log.e(TAG, "Fetch failed.", e));
  135. 3FNPUF$POGJH FirebaseRemoteConfigSettings remoteConfigSettings = new FirebaseRemoteConfigSettings.Builder()
 .setDeveloperModeEnabled(BuildConfig.DEBUG)
 .build();
 
 FirebaseRemoteConfig

    firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
 firebaseRemoteConfig.setConfigSettings(remoteConfigSettings);
 firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
 
 if (firebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
 cacheExpiration = 0;
 }
 
 firebaseRemoteConfig.fetch(cacheExpiration)
 .addOnSuccessListener(result -> Log.d(TAG, "Fetch succeeded."))
 .addOnFailureListener(e -> Log.e(TAG, "Fetch failed.", e));
  136. 3FNPUF$POGJH public void setBackgroundColor(View target) {
 String colorHex = firebaseRemoteConfig.getString("chat_bg_color");


    Log.d(TAG, "colorHex: " + colorHex);
 int color = Color.parseColor(colorHex);
 target.setBackgroundColor(color);
 }
  137. 3FNPUF$POGJH public void setBackgroundColor(View target) {
 String colorHex = firebaseRemoteConfig.getString("chat_bg_color");


    Log.d(TAG, "colorHex: " + colorHex);
 int color = Color.parseColor(colorHex);
 target.setBackgroundColor(color);
 }
  138. 3FNPUF$POGJH

  139. 3FNPUF$POGJH ˖ Ꟛ涪罏ٌ٦س׾剣⸬ח׃זְה儗꟦דؙٔؒأ ز׃ַדֹזְזוعؤه؎ٝز֮׶ ˖ ずֻׄծQSPEVDUJPO橆㞮ד♧䏝⦼׾《䖤ׅ׷ה رؿٕؓزד儗꟦ٍؗحءׁُ׸׷זוծ濼׵ זְהعو׷ه؎ٝزָ֮׷ ˖ ず劍涸ח《䖤ׅ׷⢪ְ倯ָ姻׃ְַוֲַכ嗚鎢

    ך⡭㖑֮׶կأفٓحءُד《䖤ׅ׷ծغحؙؒ ٝسד《䖤׃ג如㔐饯⹛儗ח剣⸬⻉ׅ׷זוװ׶ 倯כ圫ղկ
  140. ׉ך➭5JQT

  141. 鷞갫ا٦ز ׉ך➭5JQT

  142. ׉ך➭5JQT ˖ 3FBMUJNF%BUBCBTFכرؿٕؓزד鷞갫ا٦زָ דֹזְ ˖ 1SJPSJUZ⮚⯓䏝׾⢪׏׋ٙ٦ؙ،ٓؐٝسָ ♧菙涸 ˖ 1SJPSJUZכ⟣䠐ךٔؿ؋ٖٝأח⟣䠐ך⦼׾鏣㹀 דֹ׷կ

  143. ׉ך➭5JQT DatabaseReference newMessage = databaseReference.child(Message.PATH).push();
 newMessage.setPriority(-timestamp);

  144. ׉ך➭5JQT DatabaseReference newMessage = databaseReference.child(Message.PATH).push();
 newMessage.setPriority(-timestamp);

  145. ׉ך➭5JQT DatabaseReference newMessage = databaseReference.child(Message.PATH).push();
 newMessage.setPriority(-timestamp); ׋הִל5JNFTUBNQ׾痗〾⿾鯄

  146. ׉ך➭5JQT databaseReference.child(Message.PATH).orderByPriority();

  147. 1VMM5P3FGSFTI ׉ך➭5JQT

  148. ׉ך➭5JQT ˖ ٔأز朐ךر٦ة׾《䖤ׅ׷ꥷծ7BMVF&WFOUד ♧孡ח《׷倯岀׮֮׸לծ$IJME&WFOUדBEEׁ׸ ׷ך׾䖉א倯岀׮֮׷կ ˖ 䖓罏כծ1VMM5P3FGSFTI儗זוחוֿדر٦ةך 「⥋ָ鷿ⴖ׸׷ַⴻ倖דֹזְկ ˖ ׃׋ָ׏גծPOFTIPUך7BMVF&WFOUה

    $IJME&WFOU׾穈׫さ׻ׇ׷ךָ⸬卓涸
  149. ׉ך➭5JQT private ValueEventListener singleShotListener = new ValueEventListener() {
 @Override
 public

    void onDataChange(DataSnapshot dataSnapshot) {
 for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
 Message message = getMessageWithId(snapshot); // தུ
 updateTimestamp(message.getTimestamp());
 } ɹɹɹɹɹ// தུ
 
 databaseReference.child(Message.PATH) .orderByChild(Message.KEY_TIMESTAMP) .startAt(lastTimestamp + 1) .addChildEventListener(childAddListener);
 }
 
 @Override
 public void onCancelled(DatabaseError databaseError) { }
 };
  150. ׉ך➭5JQT private ValueEventListener singleShotListener = new ValueEventListener() {
 @Override
 public

    void onDataChange(DataSnapshot dataSnapshot) {
 for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
 Message message = getMessageWithId(snapshot); // தུ
 updateTimestamp(message.getTimestamp());
 } ɹɹɹɹɹ// தུ
 
 databaseReference.child(Message.PATH) .orderByChild(Message.KEY_TIMESTAMP) .startAt(lastTimestamp + 1) .addChildEventListener(childAddListener);
 }
 
 @Override
 public void onCancelled(DatabaseError databaseError) { }
 };
  151. ׉ך➭5JQT private ValueEventListener singleShotListener = new ValueEventListener() {
 @Override
 public

    void onDataChange(DataSnapshot dataSnapshot) {
 for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
 Message message = getMessageWithId(snapshot); // தུ
 updateTimestamp(message.getTimestamp());
 } ɹɹɹɹɹ// தུ
 
 databaseReference.child(Message.PATH) .orderByChild(Message.KEY_TIMESTAMP) .startAt(lastTimestamp + 1) .addChildEventListener(childAddListener);
 }
 
 @Override
 public void onCancelled(DatabaseError databaseError) { }
 };
  152. ׉ך➭5JQT private ValueEventListener singleShotListener = new ValueEventListener() {
 @Override
 public

    void onDataChange(DataSnapshot dataSnapshot) {
 for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
 Message message = getMessageWithId(snapshot); // தུ
 updateTimestamp(message.getTimestamp());
 } ɹɹɹɹɹ// தུ
 
 databaseReference.child(Message.PATH) .orderByChild(Message.KEY_TIMESTAMP) .startAt(lastTimestamp + 1) .addChildEventListener(childAddListener);
 }
 
 @Override
 public void onCancelled(DatabaseError databaseError) { }
 };
  153. ׉ך➭5JQT private ValueEventListener singleShotListener = new ValueEventListener() {
 @Override
 public

    void onDataChange(DataSnapshot dataSnapshot) {
 for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
 Message message = getMessageWithId(snapshot); // தུ
 updateTimestamp(message.getTimestamp());
 } ɹɹɹɹɹ// தུ
 
 databaseReference.child(Message.PATH) .orderByChild(Message.KEY_TIMESTAMP) .startAt(lastTimestamp + 1) .addChildEventListener(childAddListener);
 }
 
 @Override
 public void onCancelled(DatabaseError databaseError) { }
 };
  154. ،ؙإأⵖ䖴 ׉ך➭5JQT

  155. ׉ך➭5JQT { "rules": { ".read": false, ".write": false, "users": {

    ".read": "auth != null", "$user_id": { ".write": "auth != null && auth.uid === $user_id" } }, "messages": { ".read": "auth != null", ".indexOn": ["timestamp"], "$message_id": { ".write": "(auth != null && auth.uid === newData.child('senderUid').val()) || (auth != null && auth.uid === data.child('senderUid').val())" } } }, }
  156. ׉ך➭5JQT { "rules": { ".read": false, ".write": false, "users": {

    ".read": "auth != null", "$user_id": { ".write": "auth != null && auth.uid === $user_id" } }, "messages": { ".read": "auth != null", ".indexOn": ["timestamp"], "$message_id": { ".write": "(auth != null && auth.uid === newData.child('senderUid').val()) || (auth != null && auth.uid === data.child('senderUid').val())" } } }, } 钠鏾幥׫
  157. ׉ך➭5JQT { "rules": { ".read": false, ".write": false, "users": {

    ".read": "auth != null", "$user_id": { ".write": "auth != null && auth.uid === $user_id" } }, "messages": { ".read": "auth != null", ".indexOn": ["timestamp"], "$message_id": { ".write": "(auth != null && auth.uid === newData.child('senderUid').val()) || (auth != null && auth.uid === data.child('senderUid').val())" } } }, } 倜׃ֻ剅ֹ鴥ת׸׷ر٦ة
  158. ׉ך➭5JQT { "rules": { ".read": false, ".write": false, "users": {

    ".read": "auth != null", "$user_id": { ".write": "auth != null && auth.uid === $user_id" } }, "messages": { ".read": "auth != null", ".indexOn": ["timestamp"], "$message_id": { ".write": "(auth != null && auth.uid === newData.child('senderUid').val()) || (auth != null && auth.uid === data.child('senderUid').val())" } } }, } ֿ׸ַ׵⵴ꤐׅ׷ر٦ة
  159. תה׭ ˖ (JU)VCךٖهآزٔהرٌ،فٔ׾僽ꬊ ⹛ַ׃ג׫גֻ׌ְׁ

  160. 5IBOL:PV ׀꫼耮֮׶ָהֲ׀ְׂת׃׋կ 涯㿊俑䕕 !GVTIJSPZBNB