Releases: launchdarkly/android-client-sdk
Releases · launchdarkly/android-client-sdk
3.1.0
3.0.2
[3.0.2] - 2021-07-16
Fixed
3.0.1
[3.0.1] - 2021-06-25
Fixed
- The Android manifest has been updated to explicitly specify the
android:exportedattribute on declaredreceiverelements. This is to meet new requirements in the upcoming Android 12 release. - Increased the compile-time dependency on
jackson-databindto 2.10.5.1, due to CVE-2020-25649. - Update the dependency on the shared launchdarkly/java-sdk-common to 1.1.2 to prevent Jackson from showing up as a transitive dependency in tools that inspect module metadata.
2.14.2
[2.14.2] - 2021-06-02
Fixed
- Added check to prevent
NullPointerExceptioninDiagnosticEventProcessor.stopSchedulerwhenLDClient.closeis called before the application is foregrounded when the SDK was initialized in the background. (#127) - Log message warning that JSON flag was requested as a String has been updated to include the key of the flag requested to assist in discovering which flag is being requested with an unexpected type. (#116)
3.0.0
[3.0.0] - 2021-05-07
This major version has an accompanying Migration Guide. Please see the guide for more information on updating to this version of the SDK, as the following is just a summary of the changes.
Usages of Gson provided types have been removed from the public API, replacing JsonElement with LDValue provided by the SDK. LDValue can represent the same values as a JsonElement, but has a diferent API. See the API documentation for a detailed reference.
Added
LDConfig.Buildercustomization:- The
autoAliasingOptOutconfiguration option that is used to control the new automatic aliasing behavior of theidentifymethod; by settingautoAliasingOptOutto true,identifywill not automatically generate alias events. - The
headerTransformconfiguration option that supersedes the previousadditionalHeadersconfiguration option by allowing fully dynamic updating of headers for requests the SDK makes to the LaunchDarkly service. - The
privateAttributesconfiguration option that replacessetPrivateAttributeNames, specifying the private attributes as varargUserAttributearguments rather than aSet<String>. This allows easily specifying built-in attributes.
- The
LDUser(String)constructor that creates a fully default user.- New accessors for
LDUsergetAttribute(UserAttribute)for programmatically retrieving attribute values.getCustomAttributes()for retrieving the currently set custom attributes.getPrivateAttributes()for retrieving the attributes set to be private on this user.isAttributePrivate(UserAttribute)for checking if a given attribute is private.- Getters for all built-in attributes, e.g.
getName()
- New
LDUser.Buildermethods overloads forcustomandprivateCustom:custom(String, boolean)andprivateCustom(String, boolean)for setting custom attributes to boolean values.custom(String, int),privateCustom(String, int),custom(String, double), andprivateCustom(String, double)for setting custom attributes to numeric values.custom(String, LDValue)andprivateCustom(String, LDValue)for setting custom attributes to arbitrary data.
- The
UserAttributeclass, which provides a less error-prone way to refer to user attribute names in configuration. This class can also be used to get arbitrary attribute LDClientfunctionality:- The
aliasmethod that is used to associate two user objects for analytics purposes with an alias event. jsonValueVariationandjsonValueVariationDetail. These are equivalent to the removedjsonVariationandjsonVariationDetailother than usingLDValueinstead ofJsonElement.trackData(String, LDValue)which replacestrack(String, JsonElement). Other than changing to useLDValuethe behavior is the same.trackMetric(String, LDValue, double)which replacestrack(String, JsonElement, Double). This also usesLDValuerather thanJsonElement, and requires a metric value. Otherwise usetrackData.
- The
- The
LDGsonandLDJacksonclasses, which allow SDK classes likeLDUserto be easily converted to or from JSON using the popular Gson and Jackson frameworks. EvaluationDetail.fromValueandEvaluationDetail.errorfactory methods.LDHeaderUpdaterinterface for the newheaderTransformconfiguration option.
Fixed
- Fixed an issue where the SDK could log error level messages when attempting to send diagnostic events without an internet connection. The SDK will no longer attempt to send diagnostic events when an internet connection is known to be unavailable, and will not log an error level message if the connection fails. Thanks to @valeriyo for reporting (#107).
- Fixed an issue where
LDUserinstances created before callingLDClient.initwithout specifying a key would have the keyUNKNOWN_ANDROIDrather than a device unique key. - Fixed an issue where flags listeners would be informed of changes to unchanged flags whenever the SDK receives an entire flag set (on a new stream connection, a poll request, or any stream updates behind a relay proxy).
- Fixed an issue where a
NullPointerExceptionis thrown ifLDClient.close()is called multiple times. - Improved the proguard/R8 configuration to allow more optimization. Thanks to @valeriyo for requesting (#106)
- Fixed a potential issue where the SDK could cause additional throttling on requests to the backend service when previously throttled requests had been cancelled before completion.
Changed (requirements/dependencies/build)
- Migrated from using the Android Support Libraries to using AndroidX from Jetpack. Using AndroidX requires the
android.useAndroidXAndroid Gradle plugin flag to be set totruein your application'sgradle.propertiesfile. If your application previously set theandroid.enableJetifierAndroid Gradle plugin flag totruein it'sgradle.propertiesfile soley for the LaunchDarkly SDK, this flag can now be removed. Thanks to everyone who requested this enhancement (#103). - The minimum Android API version has been raised from API level 16 (Android 4.1 Jelly Bean) to API level 21 (Android 5.0 Lollipop).
- The SDK no longer has a dependency on Google Play Services. This dependency was only used on pre-21 Android API levels to improve TLS 1.2 compatibility, as the minimum Android version has been raised to 21, the dependency is no longer necessary.
- The SDK is now built with modern Gradle (6.7, Android plugin 4.1.3) and uses Java 8.
Changed (API)
- Package names have changed: the main SDK classes are now in
com.launchdarkly.sdkandcom.launchdarkly.sdk.android. - All
LDConfig.Buildersetters have been renamed to remove thesetprefix, e.g.LDConfig.Builder.setMobileKeyhas been renamed toLDConfig.Builder.mobileKey. LDClientAPI changes:boolVariationandintVariationno longer use nullable object types for argument and return values, instead using primitive types, e.g.Boolean boolVariation(String, Boolean)becameboolean boolVariation(String, boolean).boolVariationDetailandintVariationDetailno longer use nullable object types for argument values, instead using primitive types, e.g.boolVariationDetail(String, Boolean)becameboolVariationDetail(String, boolean).floatVariationandfloatVariationDetailhave been changed to have the same behavior as the removeddoubleVariationanddoubleVariationDetail.allFlags()now returnsMap<String, LDValue>rather thanMap<String, ?>. Rather than the returnedMapcontainingBoolean,Float, andStringtyped objects, with JSON values represented as strings, theMapcontainsLDValuetyped objects which return the source type (including complex types such as JSON arrays and objects).
EvaluationDetail.getVariationIndex()now returnsintinstead ofInteger. No variation index is now represented as the constantEvaluationReason.NO_VARIATION.EvaluationReasonis now a single concrete class rather than an abstract base class. Usages of the sub-classes can be replaced with the base class.
Changed (behavioral)
- The default polling domain (configurable with
LDConfig.Builder.pollUri) has changed fromapp.launchdarkly.comtoclientsdk.launchdarkly.com. - The default
eventsUriused to send events to the service has changed fromhttps://mobile.launchdarkly.com/mobiletohttps://mobile.launchdarkly.com. The SDK will now append the expected endpoint path (/mobile) to the configuredUri, which is more consistent with other LaunchDarkly SDKs. - For compatibility with older SDK behavior, the
LDClient.stringVariationmethod could be used to retrieve JSON flags in a serialized representation. This compatibility behavior has been removed, and attempts to request a JSON valued flag usingstringVariationwill behave the same as other mismatched type variation calls. - The
LDClient.identifymethod will now automatically generate an alias event when switching from an anonymous to a known user. This event associates the two users for analytics purposes as they most likely represent a single person. This behavior can be disabled with theautoAliasingOptOutconfiguration option. - All log messages are now tagged
LaunchDarklySdkfor easier filtering. Thanks to @valeriyo for the suggestion (#113). LDUsernow overridesequals,hashCode, andtoStringwith appropriate implementations.LDUser.Builder.country(String)andLDUser.Builder.privateCountry(String)no longer attempt to look up the country from the providedString(attempting to match it as an ISO-3166-1 alpha-2, alpha-3 code; or a country name) and set the country to the resultant IOS-3166-1 alpha-2 only if successful. The SDK no longer gives this attribute special behavior, and sets the user's country attribute directly as the providedString.
Removed
LDConfig.Builder:setBaseUri(Uri)has been removed. Please usesetPollUri(Uri)instead.setAdditionalHeaders(Map<String,String>)has been removed. Please useheaderTransform(LDHeaderUpdater)instead.setPrivateAttributeNames(Set<String>)has been removed. Please useprivateAttributes(UserAttribute...)instead.
LDUser.Builder:country(LDCountryCode)andprivateCountry(LDCountryCode)have been removed. Usecountry(String)orprivateCountry(String)to set the country value on a user.custom(String, Number)andprivateCustom(String, Number)...
2.14.1
[2.14.1] - 2021-01-14
Fixed
- Before this release, the SDK could cause an uncaught exception on certain Android implementations, when scheduling a future poll request under certain situations. This fix extends a previous fix implemented in the 2.9.1 release of the SDK, which catches
SecurityExceptions thrown by the alarm manager when registering an alarm for the next poll. ThisSecurityExceptionwas introduced by Samsung on their Lollipop and later Android implementions, and is thrown when the application has at least 500 existing alarms when registering a new alarm. After recent reports of the alarm manager throwing anIllegalStateExceptionrather than aSecurityExceptionunder the same conditions but different Android implementations, this release broadens the exception handling when scheduling a poll request to safeguard against other exception types.
2.14.0
[2.14.0] - 2020-12-17
Added
- Added
LDConfig.Builder.setPollUriconfiguration setter that is equivalent to the now deprecatedsetBaseUri. - Added
LDConfig.getPollUriconfiguration getter that is equivalent to the now deprecatedgetPollUri. - Added
LDClient.doubleVariationfor getting floating point flag values as adouble. This is preferred over the now deprecatedfloatVariation.
Fixed
- Improved event summarization logic to avoid potential runtime exceptions. Thanks to @yzheng988 for reporting (#105).
- Internal throttling logic would sometimes delay new poll or stream connections even when there were no recent connections. This caused switching active user contexts using
identifyto sometimes delay retrieving the most recent flags, and therefore delay the completion of the returnedFuture.
Changed
- The maximum delay the internal throttling logic could delay a flag request has been reduced to 60 seconds.
Deprecated
- Deprecated
LDConfig.Builder.setBaseUriandLDConfig.getBaseUri, please usesetPollUriandgetPollUriinstead. - Deprecated
LDClient.floatVariation, please usedoubleVariationfor evaluating flags with floating point values.
2.13.0
[2.13.0] - 2020-08-07
Added
- Allow specifying additional headers to be included on HTTP requests to LaunchDarkly services using
LDConfig.Builder.setAdditionalHeaders. This feature is to enable certain proxy configurations, and is not needed for normal use.
2.12.0
[2.12.0] - 2020-05-29
Added
- Added a new configuration option,
maxCachedUsersto LDConfig. This option allows configuration of the limit to how many users have their flag values cached locally in the device's SharedPreferences.
Fixed
- Fixed a NPE that could occur when calling a variation methods with a flag key that does not exist locally or is of the wrong type. This issue could only occur if a null fallback value was provided.
- Previously, the SDK manifest required the SET_ALARM permission. This permission was never used, so it has been removed.
Changed
- For polling requests, the SDK uses OkHttp with a cache configured. Previously the cache directory was set to the main application cache directory. This has been changed to a subdirectory of the application cached directory.
Deprecated
- Packages that contained only deprecated classes.
flagstore,flagstore.sharedprefs,gson,response, andtls.
2.11.0
[2.11.0] - 2020-02-28
Added
- The SDK now periodically sends diagnostic data to LaunchDarkly, describing the version and configuration of the SDK, the Android API SDK version number, and performance statistics. No credentials, Android device IDs, or other identifiable values are included. This behavior can be disabled with
LDConfig.Builder.setDiagnosticOptOut(boolean)or configured withLDConfig.Builder.setDiagnosticRecordingInterval(int). - New
LDConfig.Builderfield setterssetWrapperName(String)andsetWrapperVersion(String). These allow a library wrapping the SDK (for example, the React Native SDK) to identify itself for usage data.
Fixed
- Fixed an issue where in some cases the future associated with an
initoridentifycall would never complete if the network status or foreground state changed before the future had completed. Also improved test coverage of this behavior.
Deprecated
UserSummaryEventSharedPreferences,SummaryEventSharedPreferences,FeatureFlagFetcher,Util, andDebounce. These classes were only intended for internal SDK use, and will be removed in the next major release to reduce the number of exposed classes.