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. [SOLVED] How can i call an other App from a Qt App for Androids?

[SOLVED] How can i call an other App from a Qt App for Androids?

Scheduled Pinned Locked Moved Mobile and Embedded
android
22 Posts 3 Posters 10.9k Views 2 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.
  • X Offline
    X Offline
    xmaze
    wrote on last edited by
    #7

    if i started ok then i need something like this

    QtAndroid::startActivity("marto.rtl_tcp_andro.DeviceOpenActivity",0,0);
    

    but i cannot understand where i have to put the command
    "iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100"
    Some help please ?

    J 1 Reply Last reply
    0
    • X xmaze

      if i started ok then i need something like this

      QtAndroid::startActivity("marto.rtl_tcp_andro.DeviceOpenActivity",0,0);
      

      but i cannot understand where i have to put the command
      "iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100"
      Some help please ?

      J Offline
      J Offline
      jalomic
      wrote on last edited by p3c0
      #8

      @xmaze said:

      iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100

      For QtAndroid::startActivity you must create intent first !

      QAndroidJniObject url=QAndroidJniObject::fromString("iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100");
      QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("android/content/Intent","parseUri","(Ljava/lang/String;I)Landroid/content/Intent;", url.object<jstring>(),0x00000001);
      QtAndroid::startActivity(intent,code,receiver)
      
      X 1 Reply Last reply
      0
      • J jalomic

        @xmaze said:

        iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100

        For QtAndroid::startActivity you must create intent first !

        QAndroidJniObject url=QAndroidJniObject::fromString("iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100");
        QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("android/content/Intent","parseUri","(Ljava/lang/String;I)Landroid/content/Intent;", url.object<jstring>(),0x00000001);
        QtAndroid::startActivity(intent,code,receiver)
        
        X Offline
        X Offline
        xmaze
        wrote on last edited by
        #9

        @jalomic

        Oh my Got, Thank you very much!! This is very complicated, i couldn't find it, never!!

        J 2 Replies Last reply
        0
        • X xmaze

          @jalomic

          Oh my Got, Thank you very much!! This is very complicated, i couldn't find it, never!!

          J Offline
          J Offline
          jalomic
          wrote on last edited by
          #10

          @xmaze =) There is an much easier way
          QDesktopServices::openUrl((QUrl("iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100"))

          or just from QML

          onClicked: Qt.openUrlExternally(iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100")

          X 1 Reply Last reply
          0
          • X xmaze

            @jalomic

            Oh my Got, Thank you very much!! This is very complicated, i couldn't find it, never!!

            J Offline
            J Offline
            jalomic
            wrote on last edited by
            #11

            @xmaze And it is very interesting for me. Does it work startActivity as i showed befor ? I have no chance to check it

            X 1 Reply Last reply
            0
            • J jalomic

              @xmaze =) There is an much easier way
              QDesktopServices::openUrl((QUrl("iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100"))

              or just from QML

              onClicked: Qt.openUrlExternally(iqsrc://-f 1090000000 -s 2000000 - a 127.0.0.1 -g 100")

              X Offline
              X Offline
              xmaze
              wrote on last edited by
              #12

              @jalomic
              Thanks, but how can i call the intent? i mean the other Application!

              1 Reply Last reply
              0
              • J jalomic

                @xmaze And it is very interesting for me. Does it work startActivity as i showed befor ? I have no chance to check it

                X Offline
                X Offline
                xmaze
                wrote on last edited by
                #13

                @jalomic

                QAndroidJniObject url=QAndroidJniObject::fromString("iqsrc://-f 1090000000 -p 5000 -s 2000000 -a 127.0.0.1 -g 100");
                QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("marto/rtl_tcp_andro/DeviceOpenActivity","parseUri","(Ljava/lang/String;I)Lmarto/rtl_tcp_andro/DeviceOpenActivity;", url.object<jstring>(),0x00000001);
                QtAndroid::startActivity(intent,0,0);
                

                I tried this code but i have a black screen, i call this in Constructor of the QMainWindow, i am not sure if i call right the Application, i am not sure about the
                marto/rtl_tcp_andro/DeviceOpenActivity

                J 2 Replies Last reply
                0
                • X xmaze

                  @jalomic

                  QAndroidJniObject url=QAndroidJniObject::fromString("iqsrc://-f 1090000000 -p 5000 -s 2000000 -a 127.0.0.1 -g 100");
                  QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("marto/rtl_tcp_andro/DeviceOpenActivity","parseUri","(Ljava/lang/String;I)Lmarto/rtl_tcp_andro/DeviceOpenActivity;", url.object<jstring>(),0x00000001);
                  QtAndroid::startActivity(intent,0,0);
                  

                  I tried this code but i have a black screen, i call this in Constructor of the QMainWindow, i am not sure if i call right the Application, i am not sure about the
                  marto/rtl_tcp_andro/DeviceOpenActivity

                  J Offline
                  J Offline
                  jalomic
                  wrote on last edited by
                  #14

                  @xmaze Qt.openUrl** does it work ?

                  And replace your "marto/rtl_tcp_andro/DeviceOpenActivity" by "android/content/Intent"

                  1 Reply Last reply
                  0
                  • X xmaze

                    @jalomic

                    QAndroidJniObject url=QAndroidJniObject::fromString("iqsrc://-f 1090000000 -p 5000 -s 2000000 -a 127.0.0.1 -g 100");
                    QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("marto/rtl_tcp_andro/DeviceOpenActivity","parseUri","(Ljava/lang/String;I)Lmarto/rtl_tcp_andro/DeviceOpenActivity;", url.object<jstring>(),0x00000001);
                    QtAndroid::startActivity(intent,0,0);
                    

                    I tried this code but i have a black screen, i call this in Constructor of the QMainWindow, i am not sure if i call right the Application, i am not sure about the
                    marto/rtl_tcp_andro/DeviceOpenActivity

                    J Offline
                    J Offline
                    jalomic
                    wrote on last edited by
                    #15

                    @xmaze just copy and paste my code of creating intent

                    X 1 Reply Last reply
                    0
                    • J jalomic

                      @xmaze just copy and paste my code of creating intent

                      X Offline
                      X Offline
                      xmaze
                      wrote on last edited by
                      #16

                      @jalomic code and receiver is not something, i change this to null.

                      ok, it calls the other app but how can i wait for the other app to complete the intialitation before to process the qt app. I am not sure also if all the arguments are right, i have to make some tests and i write the results the next hours!
                      thanks

                      1 Reply Last reply
                      0
                      • X Offline
                        X Offline
                        xmaze
                        wrote on last edited by
                        #17

                        @jalomic

                        Thank you it's working!!
                        I made a workaround, i put a sleep() function for 4 seconds to wait until the other App is started!!

                        J 1 Reply Last reply
                        0
                        • X xmaze

                          @jalomic

                          Thank you it's working!!
                          I made a workaround, i put a sleep() function for 4 seconds to wait until the other App is started!!

                          J Offline
                          J Offline
                          jalomic
                          wrote on last edited by
                          #18

                          @xmaze Work what ? QDesktopServices::openUrl ? Or Intent ? Did you try openUrl ?

                          X 1 Reply Last reply
                          0
                          • J jalomic

                            @xmaze Work what ? QDesktopServices::openUrl ? Or Intent ? Did you try openUrl ?

                            X Offline
                            X Offline
                            xmaze
                            wrote on last edited by
                            #19

                            @jalomic the intent the intent, i didn't try the other solution!

                            J 1 Reply Last reply
                            0
                            • X xmaze

                              @jalomic the intent the intent, i didn't try the other solution!

                              J Offline
                              J Offline
                              jalomic
                              wrote on last edited by
                              #20

                              @xmaze Amazing =)

                              X 1 Reply Last reply
                              0
                              • J jalomic

                                @xmaze Amazing =)

                                X Offline
                                X Offline
                                xmaze
                                wrote on last edited by
                                #21

                                @jalomic Hi, i am back to ask you, how can i have prompt message if the intent does not exist? Do you have an idea?

                                J 1 Reply Last reply
                                0
                                • X xmaze

                                  @jalomic Hi, i am back to ask you, how can i have prompt message if the intent does not exist? Do you have an idea?

                                  J Offline
                                  J Offline
                                  jalomic
                                  wrote on last edited by
                                  #22

                                  @xmaze No i have not
                                  May be QAndroidActivityResultReceiver can help

                                  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