Skip to content

Commit

Permalink
Revert "rename repo and package name and apply markdown templates (#121
Browse files Browse the repository at this point in the history
…)"

This reverts commit 2215275.
  • Loading branch information
bwoskow-ld committed May 3, 2019
1 parent 0849812 commit bbbeb81
Show file tree
Hide file tree
Showing 93 changed files with 134 additions and 65 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
jobs:
build:
working_directory: ~/launchdarkly/android-client-sdk-private
working_directory: ~/launchdarkly/android-client-private
docker:
- image: circleci/android:api-27
environment:
Expand Down Expand Up @@ -63,12 +63,12 @@ jobs:
timeout: 1200
no_output_timeout: 2h

- run: ./gradlew :launchdarkly-android-client-sdk:assembleDebug --console=plain -PdisablePreDex
- run: ./gradlew :launchdarkly-android-client:assembleDebug --console=plain -PdisablePreDex

- run: circle-android wait-for-boot
- run:
name: Run Tests
command: ./gradlew :launchdarkly-android-client-sdk:connectedAndroidTest --console=plain -PdisablePreDex
command: ./gradlew :launchdarkly-android-client:connectedAndroidTest --console=plain -PdisablePreDex
no_output_timeout: 2h

- run: ./gradlew packageRelease --console=plain -PdisablePreDex
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ All notable changes to the LaunchDarkly Android SDK will be documented in this f
- Updated suggested Proguard rules for a smaller footprint.

### Fixed
- [Update to Latest version of OkHttp](https://github.com/launchdarkly/android-client-sdk/issues/20)
- [Update to Latest version of OkHttp](https://github.com/launchdarkly/android-client/issues/20)

## [1.0.1] - 2016-11-17
### Added
Expand Down
30 changes: 6 additions & 24 deletions CONTRIBUTING.md
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 :(
125 changes: 104 additions & 21 deletions README.md
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
4 changes: 2 additions & 2 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation project(path: ':launchdarkly-android-client-sdk')
implementation project(path: ':launchdarkly-android-client')
// Comment the previous line and uncomment this one to depend on the published artifact:
//implementation 'com.launchdarkly:launchdarkly-android-client-sdk:2.7.0'
//implementation 'com.launchdarkly:launchdarkly-android-client:2.7.0'

implementation 'com.jakewharton.timber:timber:4.7.1'

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ artifacts {
}

githubPages {
repoUri = 'https://github.com/launchdarkly/android-client-sdk.git'
repoUri = 'https://github.com/launchdarkly/android-client.git'
pages {
from javadoc
}
Expand Down Expand Up @@ -181,7 +181,7 @@ uploadArchives {
name 'LaunchDarkly SDK for Android'
packaging 'jar'
description 'Official LaunchDarkly SDK for Android'
url 'https://github.com/launchdarkly/android-client-sdk'
url 'https://github.com/launchdarkly/android-client'

licenses {
license {
Expand All @@ -199,9 +199,9 @@ uploadArchives {
}

scm {
connection 'scm:git:git://github.com/launchdarkly/android-client-sdk.git'
developerConnection 'scm:git:ssh:git@github.com:launchdarkly/android-client-sdk.git'
url 'https://github.com/launchdarkly/android-client-sdk'
connection 'scm:git:git://github.com/launchdarkly/android-client.git'
developerConnection 'scm:git:ssh:git@github.com:launchdarkly/android-client.git'
url 'https://github.com/launchdarkly/android-client'
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions launchdarkly-android-client/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">launchdarkly-android-client</string>
</resources>
14 changes: 9 additions & 5 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# This script updates the version for the android-client-sdk library and releases the artifact + javadoc
# This script updates the version for the android-client library and releases the artifact + javadoc
# It will only work if you have the proper credentials set up in ~/.gradle/gradle.properties

# It takes exactly one argument: the new version.
Expand All @@ -9,15 +9,19 @@
# When done you should commit and push the changes made.

set -uxe
echo "Starting android-client-sdk release."
echo "Starting android-client release."

VERSION=$1

# Update version in gradle.properties file:
sed -i.bak "s/version[ ]*=.*$/version = '${VERSION}'/" launchdarkly-android-client-sdk/build.gradle
rm -f launchdarkly-android-client-sdk/build.gradle.bak
sed -i.bak "s/version[ ]*=.*$/version = '${VERSION}'/" launchdarkly-android-client/build.gradle
rm -f launchdarkly-android-client/build.gradle.bak

# Update version in README.md:
sed -i.bak "s/com.launchdarkly:launchdarkly-android-client:[^']*/com.launchdarkly:launchdarkly-android-client:${VERSION}/" README.md
rm -f README.md.bak

./gradlew test sourcesJar javadocJar packageRelease
./gradlew uploadArchives closeAndReleaseRepository
./gradlew publishGhPages
echo "Finished android-client-sdk release."
echo "Finished android-client release."
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':launchdarkly-android-client-sdk', ':example'
include ':launchdarkly-android-client', ':example'

0 comments on commit bbbeb81

Please sign in to comment.