Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to execute USSD?
Forum Updated to NodeBB v4.3 + New Features

How to execute USSD?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
13 Posts 3 Posters 2.7k Views 3 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.
  • B Offline
    B Offline
    Blaster
    wrote on 8 May 2018, 18:02 last edited by
    #1

    Hello, I would like to know how to execute USSD codes from a qml file, for example:

    Button {
            text: "Execute USSD"
            onClicked: executeUSSD(ussdCode)
        }
    

    I need to know how to implement the executeUSSD () function

    P 1 Reply Last reply 8 May 2018, 19:03
    0
    • B Blaster
      8 May 2018, 18:02

      Hello, I would like to know how to execute USSD codes from a qml file, for example:

      Button {
              text: "Execute USSD"
              onClicked: executeUSSD(ussdCode)
          }
      

      I need to know how to implement the executeUSSD () function

      P Offline
      P Offline
      Pablo J. Rogina
      wrote on 8 May 2018, 19:03 last edited by
      #2

      @Blaster if by USSD you mean Unstructured Supplementary Service Data, I guess you may want to get some library that provides or helps you implementing that functionality. Maybe this example is a good starting point.

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • B Offline
        B Offline
        Blaster
        wrote on 8 May 2018, 20:01 last edited by Blaster 5 Aug 2018, 20:08
        #3

        I just want to run USSD codes compatible with GSM, for example *123#, from android

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 8 May 2018, 20:07 last edited by
          #4

          Hi,

          Do you mean something like described here ?

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

          B 1 Reply Last reply 9 May 2018, 18:18
          1
          • B Offline
            B Offline
            Blaster
            wrote on 8 May 2018, 20:15 last edited by
            #5

            Yes, I'll try it and then I'll tell you if it worked for me. Thank you

            1 Reply Last reply
            0
            • S SGaist
              8 May 2018, 20:07

              Hi,

              Do you mean something like described here ?

              B Offline
              B Offline
              Blaster
              wrote on 9 May 2018, 18:18 last edited by
              #6

              @SGaist I am trying to adapt the code shown in the tutorial that you put, but there is no way to find how to encode the #

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 9 May 2018, 19:37 last edited by
                #7

                Do you mean Uri.encode("#") doesn't do the job ?

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

                B 1 Reply Last reply 9 May 2018, 20:18
                0
                • B Offline
                  B Offline
                  Blaster
                  wrote on 9 May 2018, 20:03 last edited by
                  #8

                  Does anyone know how to do these in Qt?

                  private void dailNumber(String code) {
                      String ussdCode = "*" + code + Uri.encode("#");
                      startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + ussdCode)));
                  }
                  

                  I apologize for that, but now I'm learning

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 9 May 2018, 20:05 last edited by
                    #9

                    Take a look at the QtAndroidExtras module.

                    It allows you to interface easily with Java code.

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

                    1 Reply Last reply
                    2
                    • S SGaist
                      9 May 2018, 19:37

                      Do you mean Uri.encode("#") doesn't do the job ?

                      B Offline
                      B Offline
                      Blaster
                      wrote on 9 May 2018, 20:18 last edited by
                      #10
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        Blaster
                        wrote on 15 May 2018, 15:00 last edited by Blaster
                        #11

                        Well, I have already implemented the function in a java class. But I can not find the way to call it ... the problem is with startActivity (intent) the function in java is:

                        public void dailNumber(String code) {
                            String ussdCode = "*" + code + Uri.encode("#");
                            startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + ussdCode)));
                        }
                        

                        While the method with which we call it is:

                        void CallDirectly::runUSSD(QString code)
                        {
                        	QAndroidJniObject ussdCode  = QAndroidJniObject::fromString(code);
                        	QAndroidJniObject::callStaticObjectMethod("cu/myapp/javaclases",
                        												"dialNumber",
                        												"(Ljav/lang/String;)V",
                        												ussdCode.object<jstring>());
                        }
                        
                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 15 May 2018, 15:13 last edited by
                          #12

                          What is exactly your problem ?

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

                          B 1 Reply Last reply 17 May 2018, 13:36
                          0
                          • S SGaist
                            15 May 2018, 15:13

                            What is exactly your problem ?

                            B Offline
                            B Offline
                            Blaster
                            wrote on 17 May 2018, 13:36 last edited by
                            #13

                            @SGaist My problem is that I can not call the dialNumber method, it does not run. Is there something wrong with my code?

                            1 Reply Last reply
                            0

                            6/13

                            9 May 2018, 18:18

                            • Login

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