Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  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 Mobile and Embedded
2 Posts 2 Posters 227 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 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

    Christian EhrlicherC 1 Reply Last reply
    0
    • R Rajeshkannan

      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

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Dupe of https://forum.qt.io/topic/154525/unable-to-pass-a-simple-message-from-qml-to-html-vice-versa-on-android-device

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher locked this topic on

      • Login

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