commit 3b90c15ba48da8559605a58ea7a9e01fa90abb63 truex <truex@equwal.com> 2026-09-26 13:55:02 -0700 Keep the book text out of the saved state of the reader While SubRead makes the subtitles, Capacitor keeps the options of the makeSubtitles call in the saved state of the activity, two times: once from the bridge and once from the plugin. The saved state goes to the system when SubRead covers the reader, and it has a limit of about 1 MB. A book text of about 250 000 characters or more is over that limit, so Android stopped the reader with TransactionTooLargeException. SubRead reads the book text from the file book.txt. The call now removes the book text from its options after it writes that file.
android/app/src/main/java/com/equwal/scansubread/SubReadPlugin.java | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/android/app/src/main/java/com/equwal/scansubread/SubReadPlugin.java b/android/app/src/main/java/com/equwal/scansubread/SubReadPlugin.java index 84b1c79..5d6e7a6 100644 --- a/android/app/src/main/java/com/equwal/scansubread/SubReadPlugin.java +++ b/android/app/src/main/java/com/equwal/scansubread/SubReadPlugin.java @@ -439,6 +439,11 @@ public class SubReadPlugin extends Plugin { call.reject("Cannot write the book text: " + e.getMessage(), e); return; } + // While SubRead runs, Capacitor keeps the options of this call two + // times in the saved state of the activity. That state has a limit of + // about 1 MB. With a large book text, the reader crashes when SubRead + // covers it. SubRead reads the book text from the file, so remove it. + call.getData().remove("bookText"); Uri audioUri = Uri.parse(audio); Intent ask = new Intent(ACTION_ALIGN) .setPackage(SUBREAD_PACKAGE)