Core: Targets JVM/Kotlin Android: Targets Android (includes core)
In the build.gradle
for your app make sure you have jcenter()
repository as one of your repositories:
repositories {
// other repos i.e. google()
jcenter()
}
Then add this dependency when targeting Android:
dependencies {
// ...
api 'com.pusher:pusher-platform-android:$pusher_platform_version'
}
The latest version can be found here:
Alternatively, if you want to target JVM 1.7 and upwards you can add this line:
dependencies {
// ...
api 'com.pusher:pusher-platform-core:$pusher_platform_version'
}
With the latest version for Core found here:
The main entity used to access to platform services is Instance.
The simpler way to create a new instance uses 4 things:
locator
: Instance locator id in the form of 'v1:us1:1a234-123a-1234-12a3-1234123aa12'serviceName
: The name of the service this instance will useserviceVersion
: The version of the servicedependencies
: An object containing the requirements for the instance. The default implementation for Android provides all that is needed incom.pusher.platform.AndroidDependencies
Examples:
class KotlinExample {
val instance = Instance(
locator = "v1:us1:1a234-123a-1234-12a3-1234123aa12",
serviceName = "service",
serviceVersion = "v1",
dependencies = AndroidDependencies()
)
}
class JavaExample {
Instance instance = new Instance(
"v1:us1:1a234-123a-1234-12a3-1234123aa12",
"service",
"v1",
new AndroidDependencies()
);
}
We use Junit 5 and/or Spek to run unit and integration tests. In pusher-platform-core
we have two test folders. Unit tests can be located in test
and integration tests in integrationTest
. In order to run integration tests locally we have to do a couple of extra steps. They can be found here.
The two artifacts this project produces (pusher-platform-core
and pusher-platform-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 Pusher Maven account.
Now, to do the actual release run:
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.
Syncing the artifacts to Maven is also setup. It involves logging into bintray and syncing an uploaded release.
- Found a bug? Please open an issue.
- Have a feature request. Please open an issue.
- If you want to contribute, please submit a pull request (preferably with some tests 🙂 ).
- For further questions, you can come say hi on Slack
pusher-platform-android is released under the MIT license. See LICENSE for details.