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. Send data through wifi (no internet) when mobile data on
Forum Updated to NodeBB v4.3 + New Features

Send data through wifi (no internet) when mobile data on

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

    I'm using Qt & QML to develop an application that connects to a hardware device through wifi (generated by the device) and send data to it through a socket connection too. The problem is that when mobile data (3G/4G) is activated android tries to send the data through it instead of sending it through the wifi generated by the device. The issue is the same with the below post link:
    https://stackoverflow.com/questions/35152417/send-data-through-wifi-no-internet-when-mobile-data-on

    Now, I use QUdpSocket* and QTcpSocket* to bind and connectToHost Machine. I don't know how to add the addTransportType(NetworkCapabilities.TRANSPORT_WIFI) code to my Qt project. Is it possible to call that like the below sentence:
    QAndroidJniObject XXX_ObjectName = QAndroidJniObject::fromString("XXX_Key_Word");
    And how to do?

    1 Reply Last reply
    0
    • Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on last edited by Gojir4
      #2

      Hi,

      You need to define static java method and then call it from C++ using QAndroidJniObject::callStaticMethod()

      See the Qt Notifier example. It shows how to display Android notification by calling a static java method and I think it's pretty similar to what you need.

      edit: This is only a solution for calling java method from C++, I'm not sure if this will fix your issue as you are using QAbstractSocket* mechanisms.

      1 Reply Last reply
      2

      • Login

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