Run a Quart web server in Python with Chaquopy on Android (Kotlin)

preview_player
Показать описание

Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!Run a Quart web server in Python with Chaquopy on Android (Kotlin)

Error starting Python server: Method addObserver must be called on the main thread
Kotlin:

class MainActivity : AppCompatActivity() {

private val tag: String = "MainActivity" // Define a tag for your logs
private var serverPort: Int? = null
private lateinit var webView: WebView
private lateinit var swipeRefreshLayout: SwipeRefreshLayout

@SuppressLint("SetJavaScriptEnabled")
override fun onCreate(savedInstanceState: Bundle?) {

// Run the Python server in a background thread
Thread {
Log.i(tag, "Starting server")
Log.i(tag, "IS STARTED")
}
try {
} catch (e: Exception) {
}
}.start()

// Set webview
Log.i(tag, "Starting webview")
override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler?,
error: SslError?
) {
// Ignore SSL certificate errors (not recommended for production)
handler?.proceed()
}
}
}
}

fun closeLoader() {
Log.i(tag, "Close loader")
}

}

Question and source license information:
Рекомендации по теме
visit shbcf.ru