Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Unable to pass a simple message from QML to HTML vice-versa on Android device
Forum Updated to NodeBB v4.3 + New Features

Unable to pass a simple message from QML to HTML vice-versa on Android device

Scheduled Pinned Locked Moved Unsolved QtWebEngine
1 Posts 1 Posters 245 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajeshkannan
    wrote on 14 Feb 2024, 07:07 last edited by
    #1

    Hello all,

    Iam unable to pass a simple message from QML to HTML vice-versa on Android device

    What iam trying to achieve: Iwant to pass a message between QMLVs HTML and vice-versa, Over a webchannel and websocket.

    Problem statement: iam able to render the HTML file on the webview on the android device but iam facing issue in the communication between QML and HTML.

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

    For more details i have attached the complete Error Log - https://pastebin.com/FtaF2trH

    Complete source code is available in this public Google Drive Link - https://drive.google.com/file/d/1lGmbqQHzv9qJN_b9kPjiGsRjsYDu0VaW/view?usp=drive_link

    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

    1 Reply Last reply
    0
    • C Christian Ehrlicher referenced this topic on 14 Feb 2024, 07:10

    1/1

    14 Feb 2024, 07:07

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved