Skip to content

External Editing Integration ​

Third-party music players can launch Lyrico's single-song editor via Intent to edit tags, lyrics, and cover art.

1. Prepare the Audio URI ​

Obtain a content:// URI (MediaStore, SAF, or FileProvider) that supports opening a seekable file descriptor in rw mode. Custom providers must support URI read/write grants.

2. Launch the Editor ​

From your Activity:

kotlin
val intent = Intent("com.lonx.lyrico.action.EDIT_TAG").apply {
    setPackage("com.lonx.lyrico") // Use "com.lonx.lyrico.debug" for debug builds
    setDataAndType(audioUri, "audio/*")
    clipData = ClipData.newRawUri("audio", audioUri)
    addFlags(
        Intent.FLAG_GRANT_READ_URI_PERMISSION or
            Intent.FLAG_GRANT_WRITE_URI_PERMISSION
    )
}
startActivity(intent)

Catch ActivityNotFoundException and prompt the user to install Lyrico if missing.

3. Handle the Result and Refresh ​

When the user taps ✓, Lyrico writes the file and closes the editor. Your player should reload the song's tags, lyrics, and cover upon returning to the foreground.

To explicitly check whether changes were saved, use ActivityResultContracts.StartActivityForResult:

kotlin
private val editLauncher = registerForActivityResult(
    ActivityResultContracts.StartActivityForResult()
) { result ->
    if (result.resultCode == Activity.RESULT_OK) {
        result.data?.data?.let { uri ->
            // Reload tags and refresh cache for uri
        }
    }
}
  • Saved: returns RESULT_OK with the original audio URI in Intent.data.
  • Cancelled: returns RESULT_CANCELED.
  • Save failed: stays in the editor and shows the error so the user can retry.

To add your player to the supported players list, open a PR with the player name, link, and minimum supported version.