I managed to solve this problem by creating a new instance of AddContentApi every time I need to call it. But now I’m facing another issue when reviewing a card:
CardContentProvider/ answerCard - RuntimeException on answering card
net.ankiweb.rsdroid.exceptions.BackendInvalidInputException: card was modified: Normal(
Review(
ReviewState {
scheduled_days: 287,
elapsed_days: 821,
ease_factor: 2.5,
lapses: 0,
leeched: false,
memory_state: None,
},
),
) Normal(
Review(
ReviewState {
scheduled_days: 1,
elapsed_days: 4,
ease_factor: 2.5,
lapses: 0,
leeched: false,
memory_state: None,
},
),
)
at net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$Companion.fromInvalidInputError(SourceFile:40)
at net.ankiweb.rsdroid.BackendException$Companion.fromError(SourceFile:105)
at net.ankiweb.rsdroid.BackendKt.unpackResult(SourceFile:31)
at net.ankiweb.rsdroid.BackendKt.access$unpackResult(SourceFile:1)
at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:2)
at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(SourceFile:1)
at net.ankiweb.rsdroid.Backend.withBackend(SourceFile:8)
at net.ankiweb.rsdroid.Backend.runMethodRaw(SourceFile:16)
at anki.backend.GeneratedBackend.answerCardRaw(SourceFile:9)
at anki.backend.GeneratedBackend.answerCard(SourceFile:15)
at com.ichi2.libanki.sched.Scheduler.answerCard(SourceFile:5)
at com.ichi2.anki.provider.CardContentProvider.answerCard(SourceFile:30)
at com.ichi2.anki.provider.CardContentProvider.update(SourceFile:44)
at android.content.ContentProvider.update(Unknown Source:20)
at android.content.ContentProvider$Transport.update(Unknown Source:41)
at android.content.ContentProviderNative.onTransact(Unknown Source:612)
at android.os.Binder.execTransactInternal(Unknown Source:103)
at android.os.Binder.execTransact(Unknown Source:16)
It occurs only when I’m not on review mode in AnkiDroid, if I start to review the same deck I’m interacting with on my app it works fine.