A library containing the HolochainService.
This library can be used by other projects that wish to run a holochain conductor as an Android Foreground Service.
Add the Sonatype Maven Central Repository as a dependency source in your project's build.gradle.kts
repositories {
maven {
url = uri("https://repo1.maven.org/maven2")
}
// Additional respositories...
}Add the library to your dependencies list in your project's build.gradle.kts
dependencies {
...
implementation("org.holochain.androidserviceruntime:service:0.0.21")
}On Android 13 (API 33) and above, your app must request POST_NOTIFICATIONS permission at runtime.
private fun requestNotificationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
ActivityCompat.requestPermissions(
this.activity, // Use your own activity
arrayOf(Manifest.permission.POST_NOTIFICATIONS),
1 // Use your own request code
)
}
}The library can be published to a local maven repository for use in development. All other kotlin projects in this android-service-runtime git repo will check for matching dependencies in the local Maven repository before checking Maven Central.
To publish the library to the local Maven repository, run:
pnpm run build:runtime-types-ffi && pnpm run build:client && pnpm run publish:local:client && pnpm run build:runtime-ffi && pnpm run build:service && pnpm run publish:local:serviceClear the local Maven repository by deleting this library from it:
rm -rf ~/.m2/repository/org/holochainTo run the test suite:
pnpm run build:runtime-types-ffi && pnpm run publish:local:client && pnpm run build:runtime-ffi && pnpm run test:service- Copy
gradle.properties.exampletogradle.properties - Create Maven Central account at https://central.sonatype.com
- Generate a User Token
- Set
mavenCentralUsernameandmavenCentralPasswordingradle.propertiesto the displayed username and password
- Ensure your Maven Central account has permissions to the
org.holochainnamespace (you'll need to ask someone else who has permission). - Create signing key
- Create a key with:
gpg --gen-key - Retrieve your Key Id in short format with:
gpg --list-keys --keyid-format=short - Publish your public key to keyserver with:
gpg --keyserver keys.openpgp.org --send-keys <YOUR KEY ID>
- Create a key with:
- Export the signing private key to a file with:
gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg - Add signing key to
gradle.properties- Set
signing.keyIdto your public Key Id in in short format - Set
signing.passwordto the key password - Set
signing.secretKeyRingFileto the path to your exported private key file
- Set
-
Update the version number in
build.gradle.kts, undermavenPublishing>coordinates -
Run the gradle command to publish:
./gradlew publishAllPublicationsToMavenCentralRepository