This is a template for creating an Echo extension. It includes a basic structure for the extension, so you do not have to start from scratch.
Clone this repository and name it as you want.
2. Configure the gradle.properties
The file will have the following properties:
libVersion
- The version of the Echo library, defaults tomain-SNAPSHOT
.extType
- The type of the extension you want to create. It can bemusic
,tracker
orlyrics
. More information can be found inExtension<*>
java doc.extId
- The id of the extension. (Do not use spaces or special characters)extClass
- The class of the extension. This should be the class that you inherit client interfaces to. For example in this template, it isTestExtension
.extIcon
- (Optional) The icon of the extension. Will be cropped into a circle.extName
- The name of the extension.extDescription
- The description of the extension.extAuthor
- The author of the extension.extAuthorUrl
- (Optional) The author's website.extRepoUrl
- (Optional) The repository URL of the extension.extUpdateUrl
- (Optional) The update URL of the extension. The following urls are supported:
Here's where the fun begins. Echo checks for Client
interfaces that your extension implemented to know if your extension supports the feature or not.
- What are
Client
interfaces?- These are interfaces that include functions your extension need to implement (
override fun
). - For example, if you want to create a lyrics extension, you need to implement the
LyricsClient
interface.
- These are interfaces that include functions your extension need to implement (
- What interfaces are available?
- By default, the
TestExtension
implements theExtensionClient
interface. - Pro tip: Hover over the interface to see the documentation, Click on every one things that is clickable to dive deep into the rabbit hole.
- You can find all the available interfaces, for:
- By default, the
The best example of how to implement an extension should be the Spotify Extension.
If your extension needs to make network requests, you can use OkHttpClient
class provided directly by Echo. For example:
class TestExtension : ExtensionClient {
private val client = OkHttpClient()
override suspend fun someNiceFunction() {
val request = Request.Builder().url("https://example.com").build()
val response = client.newCall(request).await()
println(response.body?.string())
}
}
If you are using OkHttpClient
, use the custom await()
function for suspending the network call.
There are two ways to test the extension:
- Local testing: You can test the extension locally by running the tests in the
ExtensionUnitTest
class. - App testing: You can test the extension in the Echo app by building & installing the
app
& then opening Echo app.
This template includes a GitHub Actions workflow that will automatically build and publish the extension to GitHub releases when you make a new commit. You can find the workflow file here. You need to do the following steps to publish the extension:
- Enable
Read & write permissions
for workflows in the repository settings (Settings -> Actions -> General -> Workflow Permissions). - Generate a keystore file : https://developer.android.com/studio/publish/app-signing#generate-key
- Add action secrets in the repository settings (Settings -> Secrets and variables -> Actions -> New repository secret):
KEYSTORE_B64
- The base64 encoded keystore file. How toPASSWORD
- The password of the keystore file.