Skip to content

Commit a9abade

Browse files
committed
Hyperlink sections, switch to textual gradle.build instructions
1 parent 3b6f866 commit a9abade

File tree

1 file changed

+23
-39
lines changed

1 file changed

+23
-39
lines changed

codelabs/chat/README.md

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ What you'll learn:
1010

1111
The steps:
1212

13-
1. Register with Firebase
14-
2. Create a project in Android Studio
15-
3. Connect the Android app to Firebase
16-
4. Allow the user to send a message
17-
5. Show the messages
18-
6. Enable login
13+
1. [Register with Firebase](#register-with-firebase)
14+
2. [Create a project in Android Studio](#create-a-project-in-android-studio)
15+
3. [Connect the Android app to Firebase](#connect-the-android-app-to-firebase)
16+
4. [Send a message](#send-a-message)
17+
5. [Show the messages](#show-the-messages)
18+
6. [Enable login](#enable-login)
1919

2020
What you'll need
2121
* [Android Studio](https://developer.android.com/sdk/installing/studio.html) version 1.3 or up
@@ -80,36 +80,20 @@ In this step we'll create a project in Android Studio.
8080

8181
## Connect the Android app to Firebase
8282

83-
Before we can start writing code that interacts with our Firebase database, we'll need to make Android Studio aware that we'll be using Firebase. We need to do this in two places: in our app's `gradle.build` script and in our `AndroidManifest.xml`.
83+
Before we can start writing code that interacts with our Firebase database, we'll need to make Android Studio aware that we'll be using Firebase. We need to do this in a few places: in the `gradle.build` script for out app and in its `AndroidManifest.xml`.
8484

85-
1. Right-click on the app and click Open Module Settings
85+
1. open Gradle Scripts > build.gradle (Module: app)
8686

87-
[screenshot:module settings menu]
88-
89-
2. In the Dependencies tab, click the + under the list and Library dependency
90-
91-
[screenshot:Dependencies tab with Add Library dependency menu]
92-
93-
3. Type `firebase` in the search box and click the Search button
94-
95-
[screenshot:search for firebase]
96-
97-
4. Add `firebase-client-android`
98-
99-
[screenshot:select firebase-client-android]
100-
101-
5. Add another Library dependency, search for `firebase-ui` and add `firebase-ui:0.2` or higher
102-
103-
[screenshot:select firebase-ui:0.2.0]
87+
This file contains the steps that Android Studio uses to build our app. We'll add a reference to Firebase to it, so we can start using it.
10488

105-
6. We now have added dependencies to the Firebase SDK and the FirebaseUI support library for Android.
89+
2. add the following lines to the dependencies object at the bottom:
10690

107-
[screenshot:all dependencies]
91+
compile 'com.firebase:firebase-client-android:2.3.1'
92+
compile 'com.firebaseui:firebase-ui:0.2.0'
10893

109-
7. open Gradle Scripts > build.gradle (Module: app)
94+
This tells Gradle to include the Firebase SDK and the FirebaseUI library.
11095

111-
This file contains the steps that Android Studio uses to build our app. We'll add a reference to Firebase to it, so we can start using it.
112-
8. Add the following inside the `android` object:
96+
3. Add the following inside the `android` object:
11397

11498
packagingOptions {
11599
exclude 'META-INF/LICENSE'
@@ -121,30 +105,30 @@ Before we can start writing code that interacts with our Firebase database, we'l
121105

122106
[screenshot:gradle.build]
123107

124-
9. 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.
125109

126110
[screenshot:Sync now]
127111

128-
10. Since Firebase is a hosted service, our app will need to be able to access the internet.
129-
11. Open app > manifests > AndroidManifest.xml
130-
12. Add this line inside the `manifest` element:
112+
5. Since Firebase is a hosted service, our app will need to be able to access the internet.
113+
6. Open app > manifests > AndroidManifest.xml
114+
7. Add this line inside the `manifest` element:
131115

132116
<uses-permission android:name="android.permission.INTERNET" />
133117

134118
[screenshot:internet permission]
135119

136-
13. 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.
120+
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.
137121
open MainActivity.java and add this code to the end of the onCreate method:
138122

139123
Firebase.setAndroidContext(this);
140124

141125
This code allows the Firebase client to keep its context.
142-
14. Import Firebase at the top of your MainActivity by adding the following line:
126+
9. Import Firebase at the top of your MainActivity by adding the following line:
143127

144128
import com.firebase.client.Firebase;
145129

146-
15. If Android Studio is having trouble finding the Firebase class, be sure that you've added dependencies and have synchronized the build file with the project.
147-
16. We also want to create a connection to our database. We'll keep this connection in a member field:
130+
10. If Android Studio is having trouble finding the Firebase class, be sure that you've added dependencies and have synchronized the build file with the project.
131+
11. We also want to create a connection to our database. We'll keep this connection in a member field:
148132

149133
private Firebase mFirebaseRef;
150134

@@ -158,7 +142,7 @@ This code allows the Firebase client to keep its context.
158142

159143
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.
160144

161-
## Allow the user to send a message
145+
## Send a message
162146

163147
Now we can start sending data to Firebase! In this step we'll allow the user to enter a message in a text box. When they then click the Send button, we will send the message to Firebase.
164148

0 commit comments

Comments
 (0)