Skip to content

Commit 5b7f42d

Browse files
committed
update demo to release resources and avoid repeated receiver events
1 parent 8866549 commit 5b7f42d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/src/main/java/com/auth0/android/lock/app/DemoActivity.kt

+8
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ class DemoActivity : AppCompatActivity() {
162162
}
163163
}
164164

165+
// For demo purposes because options change dynamically, we release the resources of Lock here.
166+
// In a real app, you will have a single instance and release its resources in Activity#OnDestroy.
167+
lock?.onDestroy(this)
168+
// Create a new instance with the updated configuration
165169
lock = builder.build(this)
166170
startActivity(lock!!.newIntent(this))
167171
}
@@ -179,6 +183,10 @@ class DemoActivity : AppCompatActivity() {
179183
builder.useCode()
180184
}
181185

186+
// For demo purposes because options change dynamically, we release the resources of Lock here.
187+
// In a real app, you will have a single instance and release its resources in Activity#OnDestroy.
188+
passwordlessLock?.onDestroy(this)
189+
// Create a new instance with the updated configuration
182190
passwordlessLock = builder.build(this)
183191
startActivity(passwordlessLock!!.newIntent(this))
184192
}

0 commit comments

Comments
 (0)