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. Make an XMLHttpRequest on Android
Forum Updated to NodeBB v4.3 + New Features

Make an XMLHttpRequest on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 328 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.
  • M Offline
    M Offline
    mymike00
    wrote on last edited by
    #1

    Hi all,
    I'm trying to perform an XMLHttpRequest in QML over plain HTTP inside my LAN. It works well on my computer, but it fails once deployed on an Android device with status 0.
    My goal was to build my app using CMake but I couldn't make the AndroidManifest.xml working so I'm trying this from a QMake-built app (where the android manifest is working). So I added android.permission.INTERNET but the request still ends up with status 0.

    My test qmake app is very simple, I created it as an empty QtQuick template from QtCreator and this is my main.qml.

    import QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
        Component.onCompleted: updateModel()
        function updateModel() {
            var doc = new XMLHttpRequest();
            doc.onreadystatechange = function() {
                if (doc.readyState === XMLHttpRequest.DONE) {
                    console.log("status req: "+doc.status)
                    if (doc.status === 200) {
                        console.log(doc.responseText)
                    }
                }
            }
            doc.open("GET", "192.168.1.14:6789/AuroraClimb/list");
            doc.send();
        }
    }
    

    I am using Qt5.12.10.
    What am I doing wrong in this http call? Why it does return with status 0?
    If I need to give you some other details, please tell me.
    Thank you!

    1 Reply Last reply
    0

    • Login

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