Skip to content

Commit 1ca3b19

Browse files
authored
Add a note on plugin command scheduling on Android (#3352)
1 parent 98b3f5e commit 1ca3b19

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/content/docs/develop/Plugins/develop-mobile.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ class ExamplePlugin(private val activity: Activity): Plugin(activity) {
216216
}
217217
```
218218

219+
:::note
220+
On Android native commands are scheduled on the main thread. Performing long-running operations will cause the UI to freeze and potentially "Application Not Responding" (ANR) error.
221+
222+
If you need to wait for some blocking IO, you can launch a corouting like that:
223+
224+
```kotlin
225+
CoroutineScope(Dispatchers.IO).launch {
226+
val result = myLongRunningOperation()
227+
invoke.resolve(result)
228+
}
229+
```
230+
231+
:::
232+
219233
</TabItem>
220234
<TabItem label="iOS">
221235

0 commit comments

Comments
 (0)