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. get call notification on Android and iOS ?

get call notification on Android and iOS ?

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

    Hi,
    Is it possible to get phone call notification in Qt ? I need this on Android and iOS.
    On Android I assume that thanks to Android Extras I can dabble with java and get this notification, but how about iOS ? Any one knows?

    Best Regards
    Marek

    S 1 Reply Last reply
    0
    • M Marek

      Hi,
      Is it possible to get phone call notification in Qt ? I need this on Android and iOS.
      On Android I assume that thanks to Android Extras I can dabble with java and get this notification, but how about iOS ? Any one knows?

      Best Regards
      Marek

      S Offline
      S Offline
      Schluchti
      wrote on last edited by Schluchti
      #2

      @Marek I am not aware of any Qt APIs for android/iOs so I think you have to go the native way and implement that yourself. As you have already mentioned, you can implement the Android specific stuff with QAndroidExtras. The iOs specific implementation is often (at least in my opinion) easier than the Android one, as you can directly use Objective C.

      I haven't done this, but according to this thread I would roughly do it like this:

      • add Core Telephony framework to the ios specific section of your *.pro file
      • create a header file (*.h) and a sourcecode file (*.mm) and add those files to the ios specific section of your *.pro file. Those files are the place where the implementation takes place. i.e: you get the Core Telephony notification center and register the callback (as described in the stackoverflow thread above).

      One important thing when mixing C++ wth Objective C is: Don't pollute your header file with Objective C specific stuff, or it won't compile. Instead "hide" the implementation by using a nested, private class.

      Want to read more about Qt?

      https://gympulsr.com/blog/qt/

      Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

      M 1 Reply Last reply
      0
      • S Schluchti

        @Marek I am not aware of any Qt APIs for android/iOs so I think you have to go the native way and implement that yourself. As you have already mentioned, you can implement the Android specific stuff with QAndroidExtras. The iOs specific implementation is often (at least in my opinion) easier than the Android one, as you can directly use Objective C.

        I haven't done this, but according to this thread I would roughly do it like this:

        • add Core Telephony framework to the ios specific section of your *.pro file
        • create a header file (*.h) and a sourcecode file (*.mm) and add those files to the ios specific section of your *.pro file. Those files are the place where the implementation takes place. i.e: you get the Core Telephony notification center and register the callback (as described in the stackoverflow thread above).

        One important thing when mixing C++ wth Objective C is: Don't pollute your header file with Objective C specific stuff, or it won't compile. Instead "hide" the implementation by using a nested, private class.

        M Offline
        M Offline
        Marek
        wrote on last edited by
        #3

        @Schluchti Thanks for your answer.
        On macOS I used to call qmake to generate .xcodeproj and then continue in Xcode to compile, archive and upload.

        I know that I need to create .h and .mm file and add the last one to OBJECTIVE_SOURCES in .pro file
        but how to: "add Core Telephony framework to the ios specific section of your *.pro file" ?
        any examples of doing that, or maybe is there a way to do it just in Xcode ?

        Best Regards
        Marek

        S 1 Reply Last reply
        0
        • M Marek

          @Schluchti Thanks for your answer.
          On macOS I used to call qmake to generate .xcodeproj and then continue in Xcode to compile, archive and upload.

          I know that I need to create .h and .mm file and add the last one to OBJECTIVE_SOURCES in .pro file
          but how to: "add Core Telephony framework to the ios specific section of your *.pro file" ?
          any examples of doing that, or maybe is there a way to do it just in Xcode ?

          Best Regards
          Marek

          S Offline
          S Offline
          Schluchti
          wrote on last edited by
          #4

          @Marek

          I am not sure how the Core Telephony Framework is actually called (you have to look that up), but in general you can add framworks like this:

          ios{
              LIBS += -framework Foundation
              LIBS += -framework CoreMotion
              LIBS += -framework CoreData
              LIBS += -framework AVFoundation
              LIBS += -framework MediaPlayer
          }
          

          The above code snippet is just copied from the *.pro file of one of my projects, which uses a few different frameworks.

          Want to read more about Qt?

          https://gympulsr.com/blog/qt/

          Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Schluchti if I may

            ios {
                LIBS += \
                    -framework Foundation \
                    -framework CoreMotion \
                    -framework CoreData \
                    -framework AVFoundation \
                    -framework MediaPlayer
            }
            

            would make your .pro file lighter to read.

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

            M 1 Reply Last reply
            1
            • SGaistS SGaist

              @Schluchti if I may

              ios {
                  LIBS += \
                      -framework Foundation \
                      -framework CoreMotion \
                      -framework CoreData \
                      -framework AVFoundation \
                      -framework MediaPlayer
              }
              

              would make your .pro file lighter to read.

              M Offline
              M Offline
              Marek
              wrote on last edited by
              #6

              @SGaist @Schluchti Thanks to both of you

              Is this described somewhere ? http://doc.qt.io/qt-5/ios-support.html does not provide this info.
              I will also need In App Purchase and I have seen this also needs some Apple Framework

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Yes it is, see qmake platform notes.

                Qt proposes the QtPurchasing module for that task.

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

                M 1 Reply Last reply
                0
                • SGaistS SGaist

                  Yes it is, see qmake platform notes.

                  Qt proposes the QtPurchasing module for that task.

                  M Offline
                  M Offline
                  Marek
                  wrote on last edited by
                  #8

                  @SGaist I didn't know about QtPurchasing module, thanks

                  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