Push Notifications in QT
-
@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 } } }
-
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
-
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:
-
@Robin-Hood Did you add include/lib locations for qtcloudmessaging in your pro file?
-
@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
-
@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 + = cloudmessagingfirebaseBefore 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. -
@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>
?
-
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.