Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetwork on mobile app
Forum Updated to NodeBB v4.3 + New Features

QNetwork on mobile app

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 6 Posters 2.0k Views 4 Watching
  • 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.
  • A Offline
    A Offline
    Alfie Anil
    wrote on last edited by
    #1

    Hello everyone,
    Will QNetwork work on mobile for qt. I compiled with the android qt compiler and for some reason app won't connect. It works perfectly fine on desktop but not on Mobile.
    Any ideas?

    K 1 Reply Last reply
    0
    • A Alfie Anil

      Hello everyone,
      Will QNetwork work on mobile for qt. I compiled with the android qt compiler and for some reason app won't connect. It works perfectly fine on desktop but not on Mobile.
      Any ideas?

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Alfie-Anil

      Different classes of network are used in my applications compiled for Android. They work as expected.

      The apps work through WiFi with internal network addresses and also through the provider connection as long as there are no typical limitation as to be expected through outside access.

      You must allow network access through the AndroidManifest and may have to allow separately on your device. However, if you are not allowing the access the application would be stopped by Android anyhow.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Alfie Anil
        wrote on last edited by
        #3

        @koahnig Thanks for the reply.
        I added

        <uses-permission android:name="android.permission.INTERNET" />
        

        to the Android manifest files. Could you guide me on how I could allow separately on my device please.

        K 1 Reply Last reply
        0
        • A Alfie Anil

          @koahnig Thanks for the reply.
          I added

          <uses-permission android:name="android.permission.INTERNET" />
          

          to the Android manifest files. Could you guide me on how I could allow separately on my device please.

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @Alfie-Anil

          This might depend on your actual Android version.

          Under Android version 10 you can change the access rights by pressing longer on the app icon as you want to remove/uninstall it. However, the menu bar allows also to get "info" of the app. Under there you can change the access rights.

          With Android 9 I need to go to "settings"->"Apps" where is another entry "Apps". Inthere are all applications listed and you need to navigate to your app.

          However, there might be also differences because of manufacturer dependent gui. Better google for access rights with specific, possibly manufacturer dependent Android version.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          2
          • A Offline
            A Offline
            Alfie Anil
            wrote on last edited by
            #5

            hello @koahnig . I've done both of these, on the phone I have set it to allow wifi and mobile data use, but it still isn't connecting. Any ideas? thanks

            JonBJ 1 Reply Last reply
            0
            • A Alfie Anil

              hello @koahnig . I've done both of these, on the phone I have set it to allow wifi and mobile data use, but it still isn't connecting. Any ideas? thanks

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Alfie-Anil said in QNetwork on mobile app:

              but it still isn't connecting

              So it "does not work" but you cannot find any error reported?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Alfie Anil
                wrote on last edited by
                #7

                @JonB That's my bad, This is the error message that comes up:
                (Prototype1 is the name of the file by the way).

                W QtThread: type=1400 audit(0.0:4635): avc: denied { ioctl } for path="socket:[239265]" dev="sockfs" ino=239265 ioctlcmd=0x8b07 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tclass=netlink_route_socket permissive=0
                I chatty  : uid=10146(org.qtproject.example.Prototype1) identical 3 lines
                W QtThread: type=1400 audit(0.0:4639): avc: denied { ioctl } for path="socket:[239265]" dev="sockfs" ino=239265 ioctlcmd=0x8b07 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tclass=netlink_route_socket permissive=0
                E linker  : library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/lib/arm/libQt5Core_armeabi-v7a.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/lib/arm:/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/base.apk!/lib/armeabi-v7a", permitted_paths="/data:/mnt/expand:/data/data/org.qtproject.example.Prototype1"]
                W libPrototype1_armeabi-v7a.so: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
                D AwareBitmapCacher: handleInit switch not opened pid=16534
                I mple.Prototype: Starting profile saver IsSaveProfileNow end.
                
                JonBJ 1 Reply Last reply
                0
                • A Alfie Anil

                  @JonB That's my bad, This is the error message that comes up:
                  (Prototype1 is the name of the file by the way).

                  W QtThread: type=1400 audit(0.0:4635): avc: denied { ioctl } for path="socket:[239265]" dev="sockfs" ino=239265 ioctlcmd=0x8b07 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tclass=netlink_route_socket permissive=0
                  I chatty  : uid=10146(org.qtproject.example.Prototype1) identical 3 lines
                  W QtThread: type=1400 audit(0.0:4639): avc: denied { ioctl } for path="socket:[239265]" dev="sockfs" ino=239265 ioctlcmd=0x8b07 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tclass=netlink_route_socket permissive=0
                  E linker  : library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/lib/arm/libQt5Core_armeabi-v7a.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/lib/arm:/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/base.apk!/lib/armeabi-v7a", permitted_paths="/data:/mnt/expand:/data/data/org.qtproject.example.Prototype1"]
                  W libPrototype1_armeabi-v7a.so: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
                  D AwareBitmapCacher: handleInit switch not opened pid=16534
                  I mple.Prototype: Starting profile saver IsSaveProfileNow end.
                  
                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @Alfie-Anil said in QNetwork on mobile app:

                  QSslSocket::connectToHostEncrypted: TLS initialization failed

                  for some reason app won't connect

                  I can't tell you why, but this is why it's failing. Does it fail on just one site? Only https sites? Do you have to supply some SSL libraries with your Qt app?

                  Also what about:

                  E linker  : library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/lib/arm/libQt5Core_armeabi-v7a.so"
                  is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/lib/arm:/data/app/org.qtproject.example.Prototype1-Tdx26qf-ZSiA805j_rz_CA==/base.apk!/lib/armeabi-v7a",
                  permitted_paths="/data:/mnt/expand:/data/data/org.qtproject.example.Prototype1"]
                  

                  That looks a bit worrying, is that the cause?

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    Hitokage
                    wrote on last edited by
                    #9

                    I've had the same problem, not sure how to properly fix it but thanks to @JonB I tried to use http instead of https in my url and it started working fine!

                    SGaistS 1 Reply Last reply
                    0
                    • H Hitokage

                      I've had the same problem, not sure how to properly fix it but thanks to @JonB I tried to use http instead of https in my url and it started working fine!

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Hitokage hi,

                      The proper fix is to deploy the OpenSSL libraries along with your application.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      piervalliP 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        @Hitokage hi,

                        The proper fix is to deploy the OpenSSL libraries along with your application.

                        piervalliP Offline
                        piervalliP Offline
                        piervalli
                        wrote on last edited by
                        #11

                        @SGaist with last version of Qt creator it downloads small library for Android. You need only add the pri file.

                        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