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

Firebase for Androidを活用した爆速アプリ開発入門

Firebase for Androidを活用した爆速アプリ開発入門

Firebase for Androidを活用した爆速アプリ開発入門

3cca191bf3064fd059ea2c3d6022afbd?s=128

Fumihiko Shiroyama

November 26, 2016
Tweet

More Decks by Fumihiko Shiroyama

Other Decks in Technology

Transcript

  1. 'JSFCBTFGPS"OESPJE ׾崞欽׃׋ 旗鸞،فٔꟚ涪ⰅꟌ 涯㿊俑䕕 !GVTIJSPZBNB

  2. 荈䊹稱➜ 'VNJIJLP4IJSPZBNB !GVTIJSPZBNB /JLLFJ*OD "OESPJE"QQ%FWFMPQFS 'JSFCBTF-PWFS

  3. "OESPJE5FTUJOH#PPUDBNQ ˖ "OESPJE5FTUJOH#PPUDBNQװ׏גתׅ ˖ IUUQTBOESPJEUFTUJOHCPPUDBNQDPOOQBTTDPN ˖ "OESPJEךذأز갹䓸׏גְֹת׃׳ֲהְֲ⠓ ˖ ꟼ銮ח׮僽ꬊㄎ׿דֻ׌ְׁ ˖

    $加刑傈銮㖑⼒׭ـٗحؙB ˖ չ僇傈ַ׵⢪ִ׷"OESPJE荈⹛ذأزⰅꟌպ
  4. 劤傈ך،آؑٝت ˖ 'JSFCBTFך嚊銲ֶׁ׵ְ ˖ 'JSFCBTF׾⢪׏׋旗鸞Ꟛ涪 ˖ رٌ،فٔ稱➜ ˖ "OBMZUJDT ˖

    "VUIFOUJDBUJPO ˖ $SBTI3FQPSUJOH ˖ 3FBMUJNF%BUBCBTF ˖ 4UPSBHF ˖ 3FNPUF$POGJH
  5. 'JSFCBTFך嚊銲ֶׁ׵ְ

  6. 'JSFCBTFך嚊銲ֶׁ׵ְ

  7. 'JSFCBTFך嚊銲ֶׁ׵ְ

  8. 'JSFCBTFך嚊銲ֶׁ׵ְ ˖ (PPHMF*0דًآٍ٦،حفر٦ز ˖ 窟さٌغ؎ٕفٓحزؿؓ٦يפה鹌⻉ ˖ "OBMZUJDT׾⚥呌ה׃גծ،فٔך䧭ꞿ׾ %FWFMPQ٥(SPX٥&BSOךأذ٦آד⸇ 鸞ׅ׷

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

    %FWFMPQ٥(SPX٥&BSOךأذ٦آד⸇ 鸞ׅ׷
  10. 'JSFCBTF׾⢪׏׋旗鸞Ꟛ涪

  11. رٌ،فٔ稱➜ 'JSFCBTF׾⢪׏׋旗鸞Ꟛ涪

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

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

  14. "OBMZUJDT

  15. "OBMZUJDT

  16. "OBMZUJDT ˖ 㸣Ⰻ搀俱ծ搀ⵖꣲ ˖ 荈⹛ٖه٦ز ˖ ؙٗأفٓحزؿؓ٦ي ˖ ؿ؋طٕծ؝م٦زؚٓؿ瘝׮؟ه٦ز ˖

    #JH2VFSZהך鸬䵿 ˖ 'JSFCBTFךぐ؟٦ؽأהך鸬䵿
  17. ؎ٝأز٦ٕ倯岀 "OBMZUJDT

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


    mavenCentral()
 }
 dependencies {
 classpath 'com.google.gms:google-services:3.0.0'
 }
 } فٗآؙؑزךCVJMEHSBEMF
  19. // Top-level build file
 
 buildscript {
 repositories {
 jcenter()


    mavenCentral()
 }
 dependencies {
 classpath 'com.google.gms:google-services:3.0.0'
 }
 } فٗآؙؑزךCVJMEHSBEMF
  20. def firebase_lib_version = '10.0.0'
 
 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
  21. ،فٌٔآُ٦ٕךCVJMEHSBEMF def firebase_lib_version = '10.0.0'
 
 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'
  22. "OBMZUJDT ˖ 㛇劤כֿ׸׌ֽ ˖ %"6 8"6 ."6 ˖ ،فٔך؎ٝأز٦ٕծ刿倜ծ،ٝ؎ٝ أز٦ٕ

    ˖ ぐ珏ؿ؍ٕة ˖ فٔ㹀纏ך؎كٝزך鷏⳿ ˖ 杝荈؎كٝز׮鷏⳿〳腉
  23. ؎كٝزך鷏⳿ "OBMZUJDT

  24. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 
 Bundle purchaseInfo = new Bundle();


    purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_ID, "item_id_01234");
 purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_NAME, "FANCY WATCH"); 
 firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, purchaseInfo);
  25. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 
 Bundle purchaseInfo = new Bundle();


    purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_ID, "item_id_01234");
 purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_NAME, "FANCY WATCH"); 
 firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, purchaseInfo);
  26. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 
 Bundle purchaseInfo = new Bundle();


    purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_ID, "item_id_01234");
 purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_NAME, "FANCY WATCH"); 
 firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, purchaseInfo); 'JSFCBTF"OBMZUJDT1BSBNח فٔ㹀纏ךػًٓ٦ة纇ָ֮׷
  27. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 
 Bundle purchaseInfo = new Bundle();


    purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_ID, "item_id_01234");
 purchaseInfo.putString(FirebaseAnalytics.Param.ITEM_NAME, "FANCY WATCH"); 
 firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, purchaseInfo); 'JSFCBTF"OBMZUJDT&WFOUח فٔ㹀纏ך؎كٝز纇ָ֮׷
  28. 杝荈؎كٝزך鷏⳿ "OBMZUJDT

  29. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 Bundle params = new Bundle();
 params.putString("param_screen_name",

    "LoginActivity");
 firebaseAnalytics.logEvent("event_open_screen", params);
  30. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 Bundle params = new Bundle();
 params.putString("param_screen_name",

    "LoginActivity");
 firebaseAnalytics.logEvent("event_open_screen", params); 杝荈ך؎كٝزהػًٓ٦ة׾鷏׷׌ֽ
  31. FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
 Bundle params = new Bundle();
 params.putString("param_screen_name",

    "LoginActivity");
 firebaseAnalytics.logEvent("event_open_screen", params); 杝荈ך؎كٝزהػًٓ٦ة׾鷏׷׌ֽ 杝荈؎كٝزךػًٓ٦ة׾ろ׭׋ⴓ匿כ 垥彊דכ⳿勻זְךד銲#JH2VFSZ
  32. "6%*&/$&4 "OBMZUJDT

  33. "OBMZUJDT

  34. "OBMZUJDT

  35. "OBMZUJDT

  36. "OBMZUJDT

  37. "OBMZUJDT ˖ "VEJFODFTכ勴⟝ח״׏גِ٦ؠ׾إؚ ًٝزⴓֽׅ׷倯岀 ˖ ؿ؍ٕةה׃גⵃ欽דֹ׷➭ծ /PUJGJDBUJPOTה鸬䵿׃׋׶ׅ׷ֿה׮ד ֹ׷

  38. "VUIFOUJDBUJPO

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

    钠鏾װ،ؙإأⵖ䖴׾旗鸞ד㹋鄲דֹ׷կ ˖ ⼡せךٙٝة؎ي钠鏾 ˖ 醱侧钠鏾فٗغ؎تך钠鏾䞔㜠ך窟さ ˖ ׻ְ׻ְثٍحزדכ5XJUUFS钠鏾׾ⵃ欽׃תׅ
  40. "VUIFOUJDBUJPO

  41. "VUIFOUJDBUJPO

  42. "VUIFOUJDBUJPO

  43. "VUIFOUJDBUJPO

  44. "VUIFOUJDBUJPO

  45. "VUIFOUJDBUJPO 钠鏾䖓ך؝٦ٕغحؙ63-׾؝ؾ٦

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

  47. "VUIFOUJDBUJPO ˖ BQQTUXJUUFSDPN ˖ $SFBUF/FX"QQ 钠鏾䖓ך؝٦ٕغحؙ63-׾ل٦أز

  48. "VUIFOUJDBUJPO

  49. "VUIFOUJDBUJPO ,FZ 4FDSFU׾؝ؾ٦

  50. "VUIFOUJDBUJPO

  51. "VUIFOUJDBUJPO ,FZ 4FDSFU׾ل٦أز

  52. def firebase_lib_version = '10.0.0'
 
 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
  53. "VUIFOUJDBUJPO "OESPJE4UVEJP

  54. public class MyApplication extends Application {
 
 @Override
 public void

    onCreate() {
 super.onCreate();
 
 TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.TWITTER_KEY, BuildConfig.TWITTER_SECRET);
 Fabric.with(this, new Twitter(authConfig), new Crashlytics());
 }
 
 }
  55. public class MyApplication extends Application {
 
 @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
  56. <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>
  57. <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ؚٗ؎ٝنةٝ
  58. @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {


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


    twitterLoginButton.onActivityResult(requestCode, resultCode, data);
 } 钠鏾䖓؝٦ٕغحؙ
  60. 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) {
 }
 });
  61. 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) {
 }
 }); ؙٔحؙ
  62. 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ךز٦ؙٝ
  63. 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ך钠鏾彊⪒
  64. 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חؚٗ؎ٝ
  65. 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ⰻךِ٦ؠ
  66. 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) {
 }
 }); ♧䠐ז*%
  67. if (firebaseAuth.getCurrentUser() != null) {
 FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
 String

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

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

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

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

    ˖ 6*ה钠鏾Ⳣ椚ָמהאחז׏׋ؔ٦فٝا٦أך 'JSFBCBTF6*ָ剑鵚غ٦آّٝחז׏׋ך דծֿ׸׾⢪ֲהְֲ䩛׮֮׶կ
  72. $SBTI3FQPSUJOH

  73. $SBTI3FQPSUJOH ˖ 畭涸חְֲה$SBTIMZUJDT涸זװא ˖ *446&ך0QFO$MPTFח㼎䘔 ˖ "OBMZUJDTהך湱䚍ָ״ֻծؙٓحءُ儗ך؝ٝ ذؗأزָⴓַ׷

  74. $SBTI3FQPSUJOH ؎ٝأز٦ٕ倯岀

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

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

  77. $SBTI3FQPSUJOH

  78. $SBTI3FQPSUJOH

  79. $SBTI3FQPSUJOH

  80. $SBTI3FQPSUJOH

  81. $SBTI3FQPSUJOH

  82. $SBTI3FQPSUJOH

  83. 3FBMUJNF%BUBCBTF

  84. 3FBMUJNF%BUBCBTF ٔ،ٕة؎يず劍

  85. ٔ،ٕة؎يず劍

  86. ͜Μʹͪ͸ʂ ٔ،ٕة؎يず劍

  87. ͜Μʹͪ͸ ϩʔΧϧ%#ʹอଘ ٔ،ٕة؎يず劍

  88. ͜Μʹͪ͸ ಉظ ͜Μʹͪ͸ 'JSFCBTF ٔ،ٕة؎يず劍

  89. ͜Μʹͪ͸ ಉظ ͜Μʹͪ͸ 'JSFCBTF ͜Μʹͪ͸ ͜Μʹͪ͸ ಉظ ٔ،ٕة؎يず劍

  90. 3FBMUJNF%BUBCBTF ؔؿٓ؎ٝ؟ه٦ز

  91. ͜Μʹͪ͸ ͜Μʹͪ͸ ΦϯϥΠϯ ͜Μʹͪ͸ ͜Μʹͪ͸ ؔؿٓ؎ٝ؟ه٦ز

  92. ͜Μʹͪ͸ ϒϥδϧͷਓ ฉ͑͜·͔͢ ͜Μʹͪ͸ ΦϑϥΠϯ ͜Μʹͪ͸ ͜Μʹͪ͸ ☓ ϒϥδϧͷਓʂ ฉ͑͜·͔͢ʂ

    ؔؿٓ؎ٝ؟ه٦ز
  93. ͜Μʹͪ͸ ϒϥδϧͷਓ ฉ͑͜·͔͢ ΦϯϥΠϯ෮ؼ ˓ ͜Μʹͪ͸ ϒϥδϧͷਓ ฉ͑͜·͔͢ ͜Μʹͪ͸ ϒϥδϧͷਓ

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

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

    { "ghopper": true }, }, "ghopper": { ... }, "eclarke": { ... } } } +40/ד邌植דֹ׷⟣䠐ךر٦ة圓鸡
  96. ر٦ة圓鸡 { "users": { "alovelace": { "name": "Ada Lovelace", "contacts":

    { "ghopper": true }, }, "ghopper": { ... }, "eclarke": { ... } } } +40/ד邌植דֹ׷⟣䠐ךر٦ة圓鸡 ˟׋׌׃ٔأزכ؟ه٦زׁ׸זְ ϋογϡͰදݱ͢Δ
  97. ر٦ة圓鸡 劤傈䪔ֲر٦ة圓鸡 { "messages" : { "message01" : { "body"

    : "hello!", "senderUid" : "user0001", "type" : 0 }, ..... }, "users" : { "user01" : { "name" : "Steve", "thumbnail" : "http://example.com/img/user01.jpg" }, .... } }
  98. ر٦ة圓鸡 ًحإ٦آ׾呓秛ׅ׷خٔ٦ { "messages" : { "message01" : { "body"

    : "hello!", "senderUid" : "user0001", "type" : 0 }, ..... }, "users" : { "user01" : { "name" : "Steve", "thumbnail" : "http://example.com/img/user01.jpg" }, .... } }
  99. ر٦ة圓鸡 ِ٦ؠ׾呓秛ׅ׷خٔ٦ { "messages" : { "message01" : { "body"

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

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

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

    "hello!", "senderUid" : "user0001", "type" : 0 }, "message02" : { "body" : "How are you doing? :)", "senderUid" : "user0001", "type" : 0 }, .....ʢུʣ } }
  103. ➙傈䠐陎׃ג妜׃ְֿה

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

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

    "hello!", "senderUid" : "user0001", "type" : 0 }, "message02" : { "body" : "How are you doing? :)", "senderUid" : "user0001", "type" : 0 }, .....ʢུʣ "message10" : { "body" : "ฦ৴͠·ͨ͠ʂ", "senderUid" : "user0002", "type" : 0 } } } ௥Ճʂ
  106. 3FBMUJNF%BUBCBTF ؎ٝأز٦ٕ倯岀

  107. def firebase_lib_version = '10.0.0'
 
 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
  108. 3FBMUJNF%BUBCBTF 3FBMUJNF%BUBCBTFך暴䗙

  109. 3FBMUJNF%BUBCBTF ˖ ؎كٝزسٔـٌٝرٕ ˖ 妜׃ְة؎ىؚٝד《׶ח遤ֻךדכזֻծ圫ղ ז؎كٝزח㼎׃גٔأش׾涫ꐮ׃גֶֹծ؎ك ٝز涪欰׀הח؝٦ٕغحؙ׃ג׮׵ֲ ˖ 刿倜׾湊鋔׃׋ְر٦ةך㜥䨽ٔؿ؋ٖٝأ ח㼎׃גٔأش׾鏣㹀ׅ׷

    ֿ׸׵ך暴䗙׾䬃ִׁגֶֻֿהָꅾ銲
  110. ؎كٝزٔأشך珏겲 ٔأش ؎كٝز 欽鷿 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 ٔأزך㶨銲稆ך갫䎷ָ㢌 ׻׏׋儗חㄎל׸׷
  111. ر٦ةך知⽃ז铣׫剅ֹ // Write a message to the database FirebaseDatabase database

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

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

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

    = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef.setValue("Hello, World!"); NFTTBHF)FMMP 8PSMEה剅ֹ鴥׫
  115. ر٦ةך知⽃ז铣׫⳿׃ 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פך⿫撑
  116. ر٦ةך知⽃ז铣׫⳿׃ 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ך⡲䧭
  117. ر٦ةך知⽃ז铣׫⳿׃ 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); ر٦ةך《׶⳿׃
  118. ر٦ةך知⽃ז铣׫⳿׃ 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); ٔأشך鏣㹀
  119. ׍ז׫ח˘ ٔؿ؋ٖٝأכDIJME ד⟣䠐ך 帾ׁתד䱠׏גְֻֿהָדֹ׷ private void writeNewUser(String userId, String name,

    String email) { User user = new User(name, email); mDatabase.child("users").child(userId).setValue(user); }
  120. 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);
  121. 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);
  122. 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);
  123. 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);
  124. 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ָ⢪欽〳腉
  125. $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); // ... }
  126. $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 כ㶨銲稆ך鷄⸇
  127. $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(); // ... }
  128. $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 כ㶨銲稆ך㢌⻉
  129. $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(); // ... }
  130. $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 כ㶨銲稆ך⵴ꤐ
  131. $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(); // ... }
  132. $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 כ㶨銲稆ך갫殢Ⰵ剏
  133. $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);
  134. $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חإحز 埄ꣲךؒٓ٦瘝
  135. ٔأزח㶨銲稆׾鷄⸇ 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));
  136. ٔأزח㶨銲稆׾鷄⸇ 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ָ荈⹛涪遤ׁ׸׷
  137. ٔأزח㶨銲稆׾鷄⸇ 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ׅ׷׌ֽ
  138. 銲稆ך⚛ן剏ִ ًاحس 欽鷿 PSEFS#Z$IJME 䭷㹀׃׋㶨銲稆ך⦼׾׮הח⚛ן剏ִ PSEFS#Z,FZ 㶨銲稆ךؗ٦׾׮הח⚛ן剏ִ PSEFS#Z7BMVF 㶨銲稆荈魦ך⦼׾׮הח⚛ן剏ִ PSEFS#Z1SJPSJUZ

    ⮚⯓䏝׾׮הח⚛ן剏ִ
  139. 銲稆ך⚛ן剏ִ 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 // ... });
  140. 銲稆ך⚛ן剏ִ 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 // ... }); ⟣䠐ךٔؿ؋ٖٝأ׾⿫撑
  141. 銲稆ך⚛ן剏ִ 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 // ... }); ا٦ز勴⟝׾䭷㹀
  142. 銲稆ך⚛ן剏ִ 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 // ... }); ֿ׸תד鸐׶ٔأش׾إحز
  143. 銲稆ךؿ؍ٕة ًاحس 欽鷿 MJNJU5P'JSTU ⯓걧ַ׵O⟝《䖤 MJNJU5P-BTU 䖓倯ַ׵O⟝《䖤 TUBSU"U 勴⟝חوحثׅ׷⦼⟃꣬׾《䖤 FOE"U

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

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

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

  147. 4UPSBHF

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

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

  150. 4UPSBHF

  151. def firebase_lib_version = '10.0.0'
 
 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
  152. 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();
  153. 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();
  154. 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();
  155. 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();
  156. 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();
  157. 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);
 }
 }
  158. 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);
 }
 }
  159. 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);
 }
 }
  160. 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);
 }
 }
  161. 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);
 }
 }
  162. 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);
 }
 } ؙٓ؎،ٝزכֿ׸׾تؐٝٗ٦س
  163. 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));
 }
  164. 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));
 }
  165. 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));
 }
  166. 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));
 }
  167. 3FNPUF$POGJH

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

  169. 3FNPUF$POGJH

  170. 3FNPUF$POGJH

  171. 3FNPUF$POGJH

  172. 3FNPUF$POGJH

  173. 3FNPUF$POGJH

  174. def firebase_lib_version = '10.0.0'
 
 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
  175. 3FNPUF$POGJH

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

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

  178. 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));
  179. 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));
  180. 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));
  181. 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));
  182. 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));
  183. 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);
 }
  184. 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);
 }
  185. 3FNPUF$POGJH

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

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

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

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

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

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

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

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

  194. 1VMM5P3FGSFTI ׉ך➭5JQT

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

    $IJME&WFOU׾穈׫さ׻ׇ׷ךָ⸬卓涸
  196. ׉ך➭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) { }
 };
  197. ׉ך➭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) { }
 };
  198. ׉ך➭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) { }
 };
  199. ׉ך➭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) { }
 };
  200. ׉ך➭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) { }
 };
  201. ،ؙإأⵖ䖴 ׉ך➭5JQT

  202. ׉ך➭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())" } } }, }
  203. ׉ך➭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())" } } }, } 钠鏾幥׫
  204. ׉ך➭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())" } } }, } 倜׃ֻ剅ֹ鴥ת׸׷ر٦ة
  205. ׉ך➭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())" } } }, } ֿ׸ַ׵⵴ꤐׅ׷ر٦ة
  206. תה׭ ˖ (JU)VCךٖهآزٔהرٌ،فٔ׾僽ꬊ ⹛ַ׃ג׫גֻ׌ְׁ

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