Skip to content

Commit

Permalink
Update README.md to clarify fragment lifecycle (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
e271828- authored May 20, 2023
1 parent 5c74db2 commit 557fff1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ hCaptcha.removeOnSuccessListener(firstListener)
.verifyWithHCaptcha();
```
To release all resources you may call `HCaptcha.reset()`.
### For Jetpack Compose
```kotlin
Expand Down Expand Up @@ -194,6 +192,14 @@ val intent = Intent(context, HCaptchaActivity::class.java)
}
```
### Memory usage (fragment lifecycle)
We cache the fragment instance inside the SDK to speed up the next HCaptcha.verifyWithHCaptcha calls.
Once you are done with verification, you can call `HCaptcha.reset()` to release all allocated resources including the strong reference to `com.hcaptcha.sdk.HCaptchaDialogFragment`.
Note: If you do not call `.reset()` you will likely see a warning from tools like LeakCanary.
### Good to know
1. The listeners (`onSuccess`, `onFailure`, `onOpen`) can be called multiple times in the following cases:
1. the same client is used to invoke multiple verifications
Expand Down

0 comments on commit 557fff1

Please sign in to comment.