How to to pass a simple message from QML to HTML vice-versa on Android device using Qtwebview ,Qtwebsockets and Qtwebchannel

36 Views Asked by At

The websocket did not open ,how to make it open and start the communication between the HTML to QML.

Iam unable to pass a simple message from QML to HTML vice-versa on Android device using Qtwebview ,Qtwebsockets and Qtwebchannel.

Main Error : I chromium: [INFO:CONSOLE(18)] "Uncaught ReferenceError: qt is not defined", source: file:///android_asset/index.html (18)

Complete Error Log - https://pastebin.com/FtaF2trH

for quick referance iam also attaching below pastebin urls:

Websocket.pro file - https://pastebin.com/s9iCt8UR

websockettransport.h file - https://pastebin.com/YgMVTdPw

main.cpp file - https://pastebin.com/x9LF42nc

index.html file - https://pastebin.com/kNkBjcaP

qwebchannel.js file - https://pastebin.com/zDL2SA6T

Compilation environment details are as follows:

QtVersion -5.12.12

Kit – Android Qt 5.12.12 Clang arm64-v8a

JDK – java-8-openjdk-amd64

SDK Version: 8.0

NDK Version: 21.3.6528147

Steps i have followed to compile this & run on Android:

Step 1 - I have included webview, webchannel in websockets in the websocket. Pro file

Step 2 – i have added the required index.html, bootstrap.min.css and the qtwebchannel.js in the android asset folder like this

deployment.files += android_asset/index.html
deployment.files += android_asset/bootstrap.min.css
deployment.files += android_asset/qwebchannel.js
deployment.path = /assets
INSTALLS += deployment

what i expect: The websocket did not open ,how to make it open and start the communication between the HTML to QML

0

There are 0 best solutions below