chatkit-android
chatkit-android copied to clipboard
Android client SDK for Pusher Chatkit
Chatkit Retirement Announcement
We are sorry to say that as of April 23 2020, we will be fully retiring our Chatkit product. We understand that this will be disappointing to customers who have come to rely on the service, and are very sorry for the disruption that this will cause for them. Our sales and customer support teams are available at this time to handle enquiries and will support existing Chatkit customers as far as they can with transition. All Chatkit billing has now ceased , and customers will pay no more up to or beyond their usage for the remainder of the service. You can read more about our decision to retire Chatkit here: https://blog.pusher.com/narrowing-our-product-focus. If you are interested in learning about how you can build chat with Pusher Channels, check out our tutorials.
Pusher Chatkit Android
Find out more about Chatkit here.
The SDK is written in Kotlin, but aimed to be as Java-friendly as possible. Please report incompatibilities with Java as bugs.
Requirements
- minSdkVersion is 19 (KitKat)
Installation
The project is hosted primarily on JCenter, and synced to Maven Central.
The latest release version can be seen in the badges above.
Deprecated versions
Versions of the library below 1.0.0 are no longer supported by the backend.
To view a list of changes, please refer to the CHANGELOG.
Gradle
repositories {
jcenter()
}
dependencies {
// ...
implementation 'com.pusher:chatkit-android:$chatkit-version'
}
Maven
<!-- optional, add the primary source repo.
exclude to use mirrored version from Maven Central -->
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
<repositories>
<dependency>
<groupId>com.pusher</groupId>
<artifactId>chatkit-android</artifactId>
<version>VERSION</version>
</dependency>
Development
When building this project, you may choose to use a local version of
pusher-platform-android
.
To do so you can add the path to your local copy in your
~/.gradle/gradle.properties
:
pusher_platform_local=/path/to/pusher-platform-android
It can be either a relative or absolute path.
Testing
The SDK has integration tests which run against a real Chatkit server. The tests
can be run either using the Gradle task test
or directly in Android Studio.
In order for the tests to pass you must provide a Chatkit instance credential from the dashboard.
Important: The tests will delete any and all resources associated with the instance you provide. Create a new instance for testing purposes, and do not share it anywhere else.
To run the tests directly from Android Studio you will need to install the Spek plugin, and Spek Framework. Both plugins are needed as older tests are written using Spek 1, and newer tests are using Spek 2. To do this go to Android Studio -> Preferences -> Plugins -> search for Spek, and Spek Framework and install both plugins. If you open a Spek test file (e.g. RoomSpek), you should now see green play buttons to run each test (or a test group from a file).
You will need to add your Chatkit test instance credentials to the VM — to do this edit the run configurations -> select Spek on the left -> in the VM options field enter the following:
-Dchatkit_integration_locator=<INSTANCE_LOCATOR> -Dchatkit_integration_key=<SECRET_KEY>
To run the Gradle test task, you will need to add your Chatkit test instance
credentials to your global ~/.gradle/gradle.properties
file:
chatkit_integration_locator=<INSTANCE_LOCATOR>
chatkit_integration_key=<SECRET_KEY>
Linting
We currently use ktlint.
You can use the ktlintCheck
gradle task to check if there are any errors.
Most errors can be automatically resolved by using ktlintFormat
gradle task
— if it can't auto resolve the issue, it will let you know what to do.
We have configured our project to to be compliant with Android Kotlin Style Guide, however if you're finding that hasn't worked for you please read the installation instructions over at https://github.com/pinterest/ktlint#-with-intellij-idea.
Code Analysis
We are using detekt to help measure our
technical debt. We have two baseline files (one for chatkit-android
, and chatkit-core
)
which are the current issues we have accepted. Any new issues will fail the build
on Travis.
You can run the detekt
gradle task yourself before submitting a PR to
find out if you have introduced any new issues.
When a baseline issue is resolved, run the detektBaseline
to update the
baseline config file.
Publishing
jCenter
The two artifacts this project produces (chatkit-core
and chatkit-android
)
are published in jCenter
.
Firstly, make sure you have a BinTray account. To get the api key go to Profile > Edit > Api Key
Then you need to set up a user name and api key.
Either on your local ~/.gradle/gradle.properties
as:
bintrayUser=you-bintray-user-name
bintrayApiKey=your-bintray-api-key
Or as environment variables (mainly for CI):
BINTRAY_USER=you-bintray-user-name
BINTRAY_API_KEY=your-bintray-api-key
You will also need to have SONATYPE_GPG_PASSPHRASE
set as an environment
variable. This is, as the name suggests, the GPG passphrase for the Maven
signing key.
Now, to do the actual release run:
gradlew build
gradlew bintrayUpload
Note: The publish action will both override the current release (if it has the same version name as the current) and automatically publish the new version.
Maven
You should sync the artefacts to Maven from the Bintray web interface.