chore: migrate to LDClient.init timeout variant#14
Open
kinyoklion wants to merge 1 commit into
Open
Conversation
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
@cursor review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The example already targets the latest stable
com.launchdarkly:launchdarkly-android-client-sdk(5.13.1, latest on Maven Central), so no version bump was needed. The only change is migrating away from a deprecated SDK API:LDClient.init(app, config, context)(3-arg, returnsFuture<LDClient>) is@Deprecatedin the current SDK — initializing without a timeout is no longer recommended. Migrated to the documented replacementinit(Application, LDConfig, LDContext, int startWaitSeconds):No other deprecated SDK APIs are in use (
LDClient.get,boolVariation,registerFeatureFlagListener,flush,LDConfig.Builder(AutoEnvAttributes),LDContext.builder).Verification
./gradlew :app:assembleDebugcompiles cleanly against SDK 5.13.1. I was also able to boot a headless Android 34 emulator on this Linux VM and run the app: it initialized the client and displayedFeature flag 'my-boolean-flag' is false, confirming the newinitcall works at runtime.The "Process/System UI isn't responding" dialog is an emulator SystemUI ANR under software rendering (swiftshader), unrelated to the app — the app UI (title
hello-android, flag evaluation text) renders correctly behind it.Notes
Link to Devin session: https://app.devin.ai/sessions/c3b6a36dd8f2496580fc709886c15915
Requested by: @kinyoklion
Note
Low Risk
Single-line SDK API migration in the sample app’s startup path; no auth, data, or dependency version changes.
Overview
Replaces the deprecated three-argument
LDClient.initinMainApplicationwith the SDK-recommended overload that passes5asstartWaitSeconds, so app startup can block briefly while the client fetches fresh flag values.Inline comments document that initialization may time out after five seconds while the client remains usable with cached values.
Reviewed by Cursor Bugbot for commit 8b4cfd4. Bugbot is set up for automated code reviews on this repo. Configure here.