Как собрать поток сопрограммы в Java?JAVA

Программисты JAVA общаются здесь
Гость
Как собрать поток сопрограммы в Java?

Сообщение Гость »


I'm developing an Android library,

When the user receives a push notification it may contain deep links, that I need to return to the app.

I did in kotlin with no problem.

This is the function that is called when it needs to send the deep links

Код: Выделить всё

fun getDeepLinkFlow(): Flow = flow {
emit(deepLinks)
}
And in my kotlin test app I managed to use with no problems as well, using like this.

Код: Выделить всё

GlobalScope.launch(coroutineContext) {
SDK.getDeepLinkFlow().collect { deepLinks ->
println(deepLinks)
}
}
But now, there's a RN project that whant to use the lib, in order to do that we are doing a RN module that joins the iOS code and the Android code. But it uses java.

So, how can I use the collect from Coroutines on a Java code? or what could I do differently?


Источник: https://stackoverflow.com/questions/620 ... ow-in-java

Вернуться в «JAVA»