Skip to content

Commit 9a6ebc9

Browse files
committed
Added images for connecting the app to Firebase
1 parent 77db809 commit 9a6ebc9

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

codelabs/chat/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,26 @@ Before we can start writing code that interacts with our Firebase database, we'l
103103

104104
This tells Gradle to exclude some files that otherwise create conflicts during the build.
105105

106-
[screenshot:gradle.build]
106+
![gradle.build with Firebase additions](images/3_1.png)
107107

108-
4. At this stage you'll need to synchronize the project with the gradle files again, so Tools > Android > Sync Project with Gradle Files. Android Studio will parse the gradle files and pick up our changes.
108+
4. At this stage you'll need to synchronize the project with the gradle files again, so Tools > Android > Sync Project with Gradle Files. Android Studio will parse the gradle files and pick up our changes. You can also click the dedicated button in the toolbar
109109

110-
[screenshot:Sync now]
110+
![Sync now button in toolbar](images/3_2.png)
111111

112112
5. Since Firebase is a hosted service, our app will need to be able to access the internet.
113113
6. Open app > manifests > AndroidManifest.xml
114114
7. Add this line inside the `manifest` element:
115115

116116
<uses-permission android:name="android.permission.INTERNET" />
117117

118-
[screenshot:internet permission]
118+
![INTERNET permission in AndroidManifest.xml](images/3_3.png)
119119

120120
8. Now we can get to the Java code. The first step there is to set up initial connection between our code and its Firebase backend.
121-
open MainActivity.java and add this code to the end of the onCreate method:
121+
open `MainActivity.java` and add this code to the end of the `onCreate` method:
122122

123123
Firebase.setAndroidContext(this);
124124

125-
This code allows the Firebase client to keep its context.
125+
This code allows the Firebase client to keep its context.
126126
9. Import Firebase at the top of your MainActivity by adding the following line:
127127

128128
import com.firebase.client.Firebase;
@@ -134,11 +134,11 @@ This code allows the Firebase client to keep its context.
134134

135135
that we initialize in onCreate:
136136

137-
mFirebaseRef = new Firebase("https://<your-app>.firebaseio.com");
137+
mFirebaseRef = new Firebase("https://<your-app>.firebaseio.com");
138138

139139
Be sure to replace `<your-app>` with the name of the Firebase app you created in the first section.
140140

141-
[screenshot:MainActivity with setAndroidContext and mFirebaseRef]
141+
![MainActivity with setAndroidContext and mFirebaseRef](images/3_4.png)
142142

143143
That's all the setup that is required. Next up we'll allow the user to enter a message in our app and send the message to Firebase.
144144

codelabs/chat/images/3_1.png

225 KB
Loading

codelabs/chat/images/3_2.png

222 KB
Loading

codelabs/chat/images/3_3.png

198 KB
Loading

codelabs/chat/images/3_4.png

187 KB
Loading

0 commit comments

Comments
 (0)