Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Push Notifications in QT
Qt 6.12 LTS is out! See what's new in the release blog

Push Notifications in QT

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
25 Posts 4 Posters 19.3k Views 1 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.
  • K Offline
    K Offline
    kuzulis
    Qt Champions 2020
    wrote on last edited by
    #16

    @Robin-Hood said in Push Notifications in QT:

    mmh send your content of 'build.gradle' here.

    buildscript {
        repositories {
            jcenter()
            google()
            maven { url 'https://maven.google.com' }
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.3'
            classpath 'com.google.gms:google-services:4.0.2'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            google()
            maven { url 'https://maven.google.com' }
    
            flatDir {
                dirs "$System.env.GOOGLE_FIREBASE_SDK" + "/libs/android"
            }
        }
    }
    
    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.google.android.gms:play-services-base:15.0.1'
        implementation 'com.google.firebase:firebase-core:16.0.1'
        implementation 'com.google.firebase:firebase-messaging:17.1.0'
        implementation 'com.google.firebase.messaging.cpp:firebase_messaging_cpp@aar'
    }
    
    android {
        /*******************************************************
         * The following variables:
         * - androidBuildToolsVersion,
         * - androidCompileSdkVersion
         * - qt5AndroidDir - holds the path to qt android files
         *                   needed to build any Qt application
         *                   on Android.
         *
         * are defined in gradle.properties file. This file is
         * updated by QtCreator and androiddeployqt tools.
         * Changing them manually might break the compilation!
         *******************************************************/
    
        compileSdkVersion androidCompileSdkVersion.toInteger()
    
        buildToolsVersion androidBuildToolsVersion
    
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                res.srcDirs = [qt5AndroidDir + '/res', 'res']
                resources.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                assets.srcDirs = ['assets']
                jniLibs.srcDirs = ['libs']
           }
        }
    
        lintOptions {
            abortOnError false
        }
    
        applicationVariants.all { variant ->
            variant.outputs.all {
                outputFileName = "../" + outputFileName
            }
        }
    } 
    
    1 Reply Last reply
    1
    • R Offline
      R Offline
      Robin Hood
      wrote on last edited by
      #17

      Unfortunately that did not work. I am now trying to continue my project using qtcloudmessaging
      In the instructions it says under point 5:
      "First install QtCloudMessaging from the command line:
      qmake "CONFIG + = Embedded-Kaltiot Firebase" make make install "

      I do not know how do I install it from the command line. ... I use windows 10

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Robin Hood
        wrote on last edited by
        #18

        So I think I found where it is to install QtCloudMessaging. You can see it in the first picture. I hope that was right.
        But the compiler is still nagging :/

        I have copy the compiler report:

        C:\Users\Robin\QtProjects\build-qtcloudmessaging-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug\lib\libQt5CloudMessaging.so konnte nicht gefunden werden
        move libQt5CloudMessaging.so ..\..\lib\ 
        process_begin: CreateProcess(NULL, move libQt5CloudMessaging.so "..\..\lib ", ...) failed.
        make (e=2): Das System kann die angegebene Datei nicht finden.
        
        make[2]: [..\..\lib\libQt5CloudMessaging.so] Error 2 (ignored)
        
        …
        
        C:\Users\Robin\QtProjects\qtcloudmessaging\src\cloudmessagingembeddedkaltiot\qcloudmessagingembeddedkaltiotclient.cpp
        In file included from C:\Users\Robin\QtProjects\qtcloudmessaging\src\cloudmessagingembeddedkaltiot\qcloudmessagingembeddedkaltiotclient.cpp:29:0:
        C:\Users\Robin\QtProjects\qtcloudmessaging\src\cloudmessagingembeddedkaltiot\qcloudmessagingembeddedkaltiotclient.h:32:45: fatal error: QtCloudMessaging/QtCloudMessaging: No such file or directory
        #include <QtCloudMessaging/QtCloudMessaging>
        ^
        compilation terminated.
        make[2]: *** [.obj\qcloudmessagingembeddedkaltiotclient.obj] Error 1
        make[1]: *** [sub-cloudmessagingembeddedkaltiot-make_first] Error 2
        make[2]: Leaving directory `C:/Users/Robin/QtProjects/build-qtcloudmessaging-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/src/cloudmessagingembeddedkaltiot'
        make[1]: Leaving directory `C:/Users/Robin/QtProjects/build-qtcloudmessaging-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/src'
        make: *** [sub-src-make_first] Error 2
        16:12:54: Der Prozess "C:\Users\Robin\android-ndk-r17b\prebuilt\windows-x86_64\bin\make.exe" wurde mit dem Rückgabewert 2 beendet.
        Fehler beim Erstellen/Deployment des Projekts qtcloudmessaging (Kit: Android für armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7))
        Bei der Ausführung von Schritt "Make"
        
        

        If you want to help me, I think it would be easiest if you look at the manual -> qtcloudmessaging
        :)

        Here are three more pictures. Maybe they will help you with troubleshooting:

        1_1537282114782_Screenshot (13).png

        2_1537282114782_Screenshot (14).png

        0_1537282114780_Screenshot (12).png

        jsulmJ 1 Reply Last reply
        0
        • R Robin Hood

          So I think I found where it is to install QtCloudMessaging. You can see it in the first picture. I hope that was right.
          But the compiler is still nagging :/

          I have copy the compiler report:

          C:\Users\Robin\QtProjects\build-qtcloudmessaging-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug\lib\libQt5CloudMessaging.so konnte nicht gefunden werden
          move libQt5CloudMessaging.so ..\..\lib\ 
          process_begin: CreateProcess(NULL, move libQt5CloudMessaging.so "..\..\lib ", ...) failed.
          make (e=2): Das System kann die angegebene Datei nicht finden.
          
          make[2]: [..\..\lib\libQt5CloudMessaging.so] Error 2 (ignored)
          
          …
          
          C:\Users\Robin\QtProjects\qtcloudmessaging\src\cloudmessagingembeddedkaltiot\qcloudmessagingembeddedkaltiotclient.cpp
          In file included from C:\Users\Robin\QtProjects\qtcloudmessaging\src\cloudmessagingembeddedkaltiot\qcloudmessagingembeddedkaltiotclient.cpp:29:0:
          C:\Users\Robin\QtProjects\qtcloudmessaging\src\cloudmessagingembeddedkaltiot\qcloudmessagingembeddedkaltiotclient.h:32:45: fatal error: QtCloudMessaging/QtCloudMessaging: No such file or directory
          #include <QtCloudMessaging/QtCloudMessaging>
          ^
          compilation terminated.
          make[2]: *** [.obj\qcloudmessagingembeddedkaltiotclient.obj] Error 1
          make[1]: *** [sub-cloudmessagingembeddedkaltiot-make_first] Error 2
          make[2]: Leaving directory `C:/Users/Robin/QtProjects/build-qtcloudmessaging-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/src/cloudmessagingembeddedkaltiot'
          make[1]: Leaving directory `C:/Users/Robin/QtProjects/build-qtcloudmessaging-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/src'
          make: *** [sub-src-make_first] Error 2
          16:12:54: Der Prozess "C:\Users\Robin\android-ndk-r17b\prebuilt\windows-x86_64\bin\make.exe" wurde mit dem Rückgabewert 2 beendet.
          Fehler beim Erstellen/Deployment des Projekts qtcloudmessaging (Kit: Android für armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7))
          Bei der Ausführung von Schritt "Make"
          
          

          If you want to help me, I think it would be easiest if you look at the manual -> qtcloudmessaging
          :)

          Here are three more pictures. Maybe they will help you with troubleshooting:

          1_1537282114782_Screenshot (13).png

          2_1537282114782_Screenshot (14).png

          0_1537282114780_Screenshot (12).png

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #19

          @Robin-Hood Did you add include/lib locations for qtcloudmessaging in your pro file?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Robin-Hood Did you add include/lib locations for qtcloudmessaging in your pro file?

            R Offline
            R Offline
            Robin Hood
            wrote on last edited by
            #20

            @jsulm

            I do not know. Where would I have to add that and how would that look exactly?

            jsulmJ 1 Reply Last reply
            0
            • R Robin Hood

              @jsulm

              I do not know. Where would I have to add that and how would that look exactly?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #21

              @Robin-Hood Take a look at "Linking your application against the shared library" chapter in https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              R 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Robin-Hood Take a look at "Linking your application against the shared library" chapter in https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application

                R Offline
                R Offline
                Robin Hood
                wrote on last edited by
                #22

                @jsulm
                I do not see any libs I could add. I have done it as it says in the instructions under point 6.
                Here is the link to the instructions: QtCloudMessaging
                So I wrote the code to several pro files:
                QT + = cloud messaging
                QT + = cloudmessagingfirebase

                Before that, I added the code in my qmake scribt:
                "CONFIG + = firebase",
                as I the instructions under point 1 stands.
                If you scroll something up, you can see it in the first picture.

                jsulmJ 1 Reply Last reply
                0
                • R Robin Hood

                  @jsulm
                  I do not see any libs I could add. I have done it as it says in the instructions under point 6.
                  Here is the link to the instructions: QtCloudMessaging
                  So I wrote the code to several pro files:
                  QT + = cloud messaging
                  QT + = cloudmessagingfirebase

                  Before that, I added the code in my qmake scribt:
                  "CONFIG + = firebase",
                  as I the instructions under point 1 stands.
                  If you scroll something up, you can see it in the first picture.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #23

                  @Robin-Hood said in Push Notifications in QT:

                  QT + = cloud messaging

                  it should be

                  QT + = cloudmessaging
                  

                  Shouldn't you do the include like this

                  #include <QtCloudMessaging>
                  

                  ?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  R 1 Reply Last reply
                  1
                  • jsulmJ jsulm

                    @Robin-Hood said in Push Notifications in QT:

                    QT + = cloud messaging

                    it should be

                    QT + = cloudmessaging
                    

                    Shouldn't you do the include like this

                    #include <QtCloudMessaging>
                    

                    ?

                    R Offline
                    R Offline
                    Robin Hood
                    wrote on last edited by
                    #24

                    @jsulm

                    Yes, I was just prescribed. That's what I wrote in the code. I just downloaded the package from Githup and followed the instructions ...

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Robin Hood
                      wrote on last edited by
                      #25

                      Hello,

                      I would like to integrate the existing Qt project QtFirebase Example in another Qt project. I thought about a solution via libs (libaries). When it exists a simple method, for example with libs or other, I'm grateful for comments. Otherwise I know that you can subdivide via subdir, but I would need a step by step statement.

                      To clarify again, my point is to include push notifications in an existing Qt project. I've done the QtFirebase Example and I can get push notifications. Now I would like to integrate this functionality into another project. As mentioned earlier, it would be best if I clicked "Add to Library" within another project and the push notification feature is added.

                      Surely there must be a possibility, I am convinced of that. Request for feedback.

                      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
                      • Unsolved