-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "rename repo and package name and apply markdown templates (#121…
…)" This reverts commit 2215275.
- Loading branch information
1 parent
0849812
commit bbbeb81
Showing
93 changed files
with
134 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
# Contributing to the LaunchDarkly SDK for Android | ||
|
||
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK. | ||
|
||
## Submitting bug reports and feature requests | ||
|
||
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/android-client-sdk/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days. | ||
|
||
## Submitting pull requests | ||
|
||
We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days. | ||
|
||
## Build instructions | ||
|
||
### Prerequisites | ||
|
||
1. Download and install [Android Studio](https://developer.android.com/studio/index.html) | ||
# How to work on this project | ||
1. [Get Android Studio](https://developer.android.com/studio/index.html) | ||
1. Open it and follow setup prompts. You'll at least want API versions 23 and 24. | ||
1. Open the android-client-sdk project in Android Studio. | ||
1. Drag the android-client folder to the Android Studio icon in the dock. | ||
1. Enter your mobile key in MainActivity.java | ||
1. To run, there should be a green triangle button. Hit it. | ||
|
||
### Building and running | ||
|
||
To build and run, there should be a "Run" green triangle button in the Android Studio UI for your app. Click it. | ||
|
||
### Testing | ||
|
||
To run all tests, there should be a "Run tests" green triangle button in the Android Studio UI. Click it. | ||
## Known Issues | ||
- Docker and the Android Emulator can't run at the same time :( |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,125 @@ | ||
# LaunchDarkly SDK for Android | ||
# LaunchDarkly Android SDK | ||
This library is compatible with Android SDK versions 16 and up (4.1 Jelly Bean) | ||
|
||
## LaunchDarkly overview | ||
|
||
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today! | ||
How to use: | ||
Check out the included example app, or follow things here: | ||
|
||
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly) | ||
1. Declare this dependency: | ||
|
||
## Supported Android versions | ||
``` | ||
compile 'com.launchdarkly:launchdarkly-android-client:2.7.0' | ||
``` | ||
1. In your application configure and initialize the client: | ||
|
||
This version of the LaunchDarkly SDK has been tested with Android SDK versions 16 and up (4.1 Jelly Bean). | ||
``` | ||
LDConfig ldConfig = new LDConfig.Builder() | ||
.setMobileKey("YOUR_MOBILE_KEY") | ||
.build(); | ||
|
||
## Getting started | ||
LDUser user = new LDUser.Builder("user key") | ||
.email("fake@example.com") | ||
.build(); | ||
|
||
Refer to the [SDK documentation](https://docs.launchdarkly.com/docs/android-sdk-reference#section-getting-started) for instructions on getting started with using the SDK. | ||
// NOTE: This method blocks for up to 5 seconds. See Javadoc or http://docs.launchdarkly.com/docs/android-sdk-reference | ||
// for nonblocking options. | ||
LDClient ldClient = LDClient.init(this.getApplication(), ldConfig, user, 5); | ||
``` | ||
1. Evaluation example: | ||
``` | ||
variationResult = ldClient.stringVariation(flagKey, "fallback"); | ||
``` | ||
1. Updating the User: | ||
## Learn more | ||
``` | ||
LDUser updatedUser = new LDUser.Builder(user) | ||
.email("fake2@example.com") | ||
.build(); | ||
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/docs/android-sdk-reference) or our [Javadocs](http://launchdarkly.github.io/android-client-sdk/). | ||
ldClient.identify(user); | ||
``` | ||
## Testing | ||
## ProGuard/R8 Config | ||
If you're using ProGuard or R8, the configuration for the Android SDK | ||
should be automatically included from the `aar` artifact. If this is | ||
not the case for your build please include the Proguard configuration | ||
lines from | ||
[`consumer-proguard-rules.pro`](launchdarkly-android-client/consumer-proguard-rules.pro) | ||
into your proguard file. | ||
## Feature Flag Updating | ||
The LaunchDarkly Android SDK defaults to what we have found to be the best combination of low latency updates and minimal battery drain: | ||
1. When the app is foregrounded a [Server-Sent Events](https://en.wikipedia.org/wiki/Server-sent_events) streaming connection is made to LaunchDarkly. This streaming connection stays open as long as your app is in the foreground and is connected to the internet. | ||
1. When the app is backgrounded, the stream connection is terminated and the SDK will poll (with caching) for flag updates every 15 minutes. | ||
1. When the app is foregrounded, we fetch the latest flags and reconnect to the stream. | ||
1. In either the foreground or background, we don't try to update unless your device has internet connectivity. | ||
This configuration means that you will get near real-time updates for your feature flag values when the app is in the foreground. | ||
### Other Options | ||
If you prefer other options, here they are: | ||
1. Streaming can be disabled in favor of polling updates. To disable streaming call `.setStream(false)` on the `LDConfig.Builder` object. | ||
1. The default polling interval is 5 minutes. To change it call `.setPollingIntervalMillis()` on the `LDConfig.Builder` object. | ||
1. Background polling can be disabled (the app will only receive updates when the app is in the foreground). To disable background updating call `.setDisableBackgroundUpdating(true)` on the `LDConfig.Builder` object. | ||
1. The background polling interval can be adjusted (with the same minimum of 60 seconds). To change it call `.setBackgroundPollingIntervalMillis()` on the `LDConfig.Builder` object. | ||
We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly. | ||
Example config with streaming disabled and custom polling intervals: | ||
## Contributing | ||
``` | ||
LDConfig config = new LDConfig.Builder() | ||
.setStream(false) | ||
.setPollingIntervalMillis(600_000) // 10 minutes | ||
.setBackgroundPollingIntervalMillis(3_600_000) // 1 hour | ||
.build(); | ||
``` | ||
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK. | ||
## Known Issues/Features not yet implemented: | ||
- Make Android linter happy | ||
## About LaunchDarkly | ||
Learn more | ||
---------- | ||
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/android-sdk-reference) or our [Javadocs](http://launchdarkly.github.io/android-client/). | ||
## Testing | ||
Much of the behavior we want to assert is around complicated device state changes such as | ||
app backgrounding, loss of internet connection. These are problematic to test in a programmatic way, | ||
so we rely on a combination of automated emulator tests and manual tests. | ||
If, when running tests, the Android Studio build starts throwing countDebugDexMethods and countReleaseDexMethods errors | ||
using the run configuration dropdown, then switch to the command-line and exclude the two DEX methods causing the trouble. | ||
> ./gradlew -x :launchdarkly-android-client:countDebugDexMethods -x :launchdarkly-android-client:countReleaseDexMethods -x :launchdarkly-android-client:signArchives --stacktrace clean build test cAT | ||
About LaunchDarkly | ||
----------- | ||
* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: | ||
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. | ||
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). | ||
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. | ||
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. | ||
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list. | ||
* LaunchDarkly provides feature flag SDKs for | ||
* [Java](http://docs.launchdarkly.com/docs/java-sdk-reference "Java SDK") | ||
* [JavaScript](http://docs.launchdarkly.com/docs/js-sdk-reference "LaunchDarkly JavaScript SDK") | ||
* [PHP](http://docs.launchdarkly.com/docs/php-sdk-reference "LaunchDarkly PHP SDK") | ||
* [Python](http://docs.launchdarkly.com/docs/python-sdk-reference "LaunchDarkly Python SDK") | ||
* [Python Twisted](http://docs.launchdarkly.com/docs/python-twisted-sdk-reference "LaunchDarkly Python Twisted SDK") | ||
* [Go](http://docs.launchdarkly.com/docs/go-sdk-reference "LaunchDarkly Go SDK") | ||
* [Node.JS](http://docs.launchdarkly.com/docs/node-sdk-reference "LaunchDarkly Node SDK") | ||
* [.NET](http://docs.launchdarkly.com/docs/dotnet-sdk-reference "LaunchDarkly .Net SDK") | ||
* [Ruby](http://docs.launchdarkly.com/docs/ruby-sdk-reference "LaunchDarkly Ruby SDK") | ||
* [iOS](http://docs.launchdarkly.com/docs/ios-sdk-reference "LaunchDarkly iOS SDK") | ||
* [Android](http://docs.launchdarkly.com/docs/android-sdk-reference "LaunchDarkly Android SDK") | ||
* Explore LaunchDarkly | ||
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information | ||
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides | ||
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation | ||
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates | ||
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies | ||
* [launchdarkly.com](http://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information | ||
* [docs.launchdarkly.com](http://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDKs | ||
* [apidocs.launchdarkly.com](http://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation | ||
* [blog.launchdarkly.com](http://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates | ||
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies | ||
This file contains 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
3 changes: 0 additions & 3 deletions
3
launchdarkly-android-client-sdk/src/main/res/values/strings.xml
This file was deleted.
Oops, something went wrong.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="app_name">launchdarkly-android-client</string> | ||
</resources> |
File renamed without changes.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include ':launchdarkly-android-client-sdk', ':example' | ||
include ':launchdarkly-android-client', ':example' |