Skip to content

Commit 4e9f44a

Browse files
Android App should display login screen in start state (#1090)
1 parent fa6f648 commit 4e9f44a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

source/includes/steps-tutorial-android-kotlin.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,26 @@ title: Create the Realm App
208208
ref: create-realm-app
209209
content: |
210210
211-
Navigate to ``TaskTracker``, which initializes {+service-short+} and
212-
sets the SDK log level. You should instantiate ``taskApp``, the global
213-
{+service-short+} App reference, here:
211+
Navigate to ``TaskTracker``. Android automatically runs the
212+
``onCreate()`` lifecycle method of this class when you launch
213+
the Task Tracker app. This happens because ``TaskTracker`` is
214+
configured as the global ``Application`` reference in
215+
``AndroidManifest.xml``. This allows us to run certain logic
216+
once each time you run the app, such as:
217+
218+
- initializing {+service-short+}
219+
- defining the global ``App`` reference using the ``appId``
220+
variable you just configured in your app-level
221+
``build.gradle`` file
222+
- setting the {+service-short+} log level
214223
215224
.. literalinclude:: /tutorial/generated/code/final/TaskTracker.codeblock.initialize-realm-and-create-app.kt
216225
:language: kotlin
226+
227+
You don't need to make any changes to this file right now,
228+
but it is useful to know where to configure these global
229+
settings in case you need to change the log level or debug
230+
issues with your App connection.
217231
218232
---
219233
title: Enable Authentication

tutorial/kotlin-android/app/src/main/java/com/mongodb/tasktracker/TaskTracker.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,9 @@ class TaskTracker : Application() {
2727
// Initialize the Realm SDK
2828
Realm.init(this)
2929
// :code-block-start: initialize-realm-and-create-app
30-
// :state-start: final
3130
taskApp = App(
3231
AppConfiguration.Builder(BuildConfig.MONGODB_REALM_APP_ID)
3332
.build())
34-
// :state-end: :state-uncomment-start: start
35-
//// TODO: Create the App object we will use to communicate with the Realm backend.
36-
// :state-uncomment-end:
3733
// :code-block-end:
3834

3935
// Enable more logging in debug mode

0 commit comments

Comments
 (0)