Forums

OverviewFelgo Plugins Support › Google Cloude messaging

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #15914

    Nicola

    Hi,

    in the v-play documentation is missed that we must add java service and the app registration, right? When will be supported the firebase?

    So i need to only the registration listener? The receive is already in the plugin?

    Nicola

    #15917

    Lorenz

    Hi Nicola,

    It is not required for you to add custom Java code.

    The java services should be added by gradle if you add the plugin like

     dependencies {
       compile 'net.vplay.plugins:plugin-gcm:2.+'
     }

    Additionally, you have to follow the integration steps listed here to add the GoogleServices.json to your project.

    Do you have trouble with registering your device for push notifications?

    Best,

    Lorenz from Felgo

    #15918

    Nicola

    Good, to know. I don’t try yet, i want understand before. I want send the registration code to my server (to do my dispatcher action), how can iget this code from your plugin?

    Thanks

    #15919

    Lorenz

    Hi Nicola,

    At the moment, there is no public API available for receiving the token. For most use-cases, the usage of the GCM topic concept is sufficient. You can find examples for that here.

    What’s your use-case that would require the tokens?

    Best,

    Lorenz from Felgo

    #15920

    Nicola

    Hi,

    i would have the token to send a notify to one user (ie. admin of the system), but i think that i can do using a particular topic, right?

    Nicola

    #15922

    Nicola

    This is my grandle file:

    buildscript {
        repositories {
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.0'
            classpath 'com.google.gms:google-services:3.0.0'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            maven { url 'https://sdk.felgo.com/maven/' }
        }
    }
    
    apply plugin: 'com.android.application'
    
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'net.vplay.plugins:plugin-gcm:2.+'
    }
    
    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
        }
    }
    apply plugin: 'com.google.gms.google-services'

     

    But it have this error:

    google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.

    please apply google-services plugin at the bottom of the build file.

    #15939

    Nicola

    Hi,

    i fixed the build grandle, now the app start but doesn’t receive the notification.

    I pushed the google-services.json in the android directory

    set the v-play license code

    and added this code:

    GoogleCloudMessaging {
    
           topics:[ "background-topic-1" ]
            onNotificationReceived: {
                console.log("NOTIFY")
            }
         }

     

    #15941

    Lorenz

    Hi Nicola,

    That QML snippet definitely looks OK!

    Can you show me the the message you are trying to send? Are you sending the push notification via cURL?

    Best,

    Lorenz

    #15942

    Nicola

    I send it:

    {
    “to”: “/topics/background-topic-1”,
    “data”: {
    “content-available”: 2
    },
    “priority”: “high”
    }

    with postman (in the header the Authorization field key=xx and in the body the json), and postman return me success with a message id.

    My grandle file is now:

    buildscript {
        repositories {
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.0'
            classpath 'com.google.gms:google-services:3.0.0'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            maven { url 'https://sdk.felgo.com/maven/' }
        }
    }
    
    apply plugin: 'com.android.application'
    
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'net.vplay.plugins:plugin-gcm:2.+'
        compile 'com.google.firebase:firebase-appindexing:10.0.0'
    
    }
    
    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
        }
    }
    apply plugin: 'com.google.gms.google-services'
    

     

     

    #15943

    Lorenz

    Hi,

    The “content-available” property you are using triggers a background download. You can use it to download JSON/XML while your app is not running.

    The push notification is then not processed like normal notifications.

    Is that really what you want to do? (refer to the docs here)

    For a normal push notification, I would suggest a payload like this:

    {
       "to": "/topics/background-topic-1",
       "notification": {
         "title": "Json Title",
         "body": "Json Message"
       },
       "priority": "high"
     }

     

    Cheers,

    Lorenz

    #15944

    Nicola

    Hi,

    i tried your json, but nothing. My case it’s send “normal” notifcation, a message (also when the app it’s not running). I done it usually with native app. I don’t understand what i wrong with qt.

    Nicola

    #15946

    Nicola

    HI,

    in the log i have this errors (and for me it’s very urgent):

    ailed to load module version: 
                                                    java.lang.IllegalArgumentException: module com.google.android.gms.flags not found
                                                        at com.google.android.chimera.container.ConfigurationManager.getModuleVersion(:com.google.android.gms:564)
                                                        at com.google.android.gms.chimera.container.ModuleProvider.query(:com.google.android.gms:1103)
                                                        at android.content.ContentProvider.query(ContentProvider.java:857)
                                                        at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
                                                        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
                                                        at android.os.Binder.execTransact(Binder.java:404)
                                                        at dalvik.system.NativeStart.run(Native Method)
    02-16 02:12:43.029 816-2624/? W/ModuleProvider: Failed to load module version after staging APKs
                                                    java.lang.IllegalArgumentException: module com.google.android.gms.flags not found
                                                        at com.google.android.chimera.container.ConfigurationManager.getModuleVersion(:com.google.android.gms:564)
                                                        at com.google.android.gms.chimera.container.ModuleProvider.query(:com.google.android.gms:1110)
                                                        at android.content.ContentProvider.query(ContentProvider.java:857)
                                                        at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
                                                        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
                                                        at android.os.Binder.execTransact(Binder.java:404)
                                                        at dalvik.system.NativeStart.run(Native Method)
    02-16 02:12:43.029 14224-14224/? I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:0

     

     

    02-16 02:11:55.879 547-571/? W/PackageManager: Unknown permission com.google.android.gms.permission.CAR_SPEED in package com.google.android.apps.maps
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.MANAGE_SOUND_TRIGGER in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.RECOVERY in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Not granting permission android.permission.READ_DREAM_STATE to package com.google.android.gms (protectionLevel=2 flags=0xc83ec5)
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.PROVIDE_TRUST_AGENT in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission com.google.android.apps.enterprise.dmagent.permission.AutoSyncPermission in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Not granting permission android.permission.READ_PRIVILEGED_PHONE_STATE to package com.google.android.gms (protectionLevel=18 flags=0xc83ec5)
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.USE_FINGERPRINT in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.SEND_SMS_NO_CONFIRMATION in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Not granting permission android.permission.PACKAGE_USAGE_STATS to package com.google.android.gms (protectionLevel=18 flags=0xc83ec5)
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.MANAGE_VOICE_KEYPHRASES in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.TETHER_PRIVILEGED in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.REAL_GET_TASKS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.READ_OEM_UNLOCK_STATE in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.SCORE_NETWORKS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.OVERRIDE_WIFI_CONFIG in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.CONTROL_INCALL_EXPERIENCE in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.USER_ACTIVITY in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.MODIFY_AUDIO_ROUTING in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission com.google.android.wearable.READ_SETTINGS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.INTENT_FILTER_VERIFICATION_AGENT in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.LOCAL_MAC_ADDRESS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.READ_WIFI_CREDENTIAL in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.BODY_SENSORS in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission android.permission.NOTIFY_PENDING_SYSTEM_UPDATE in package com.google.android.gms
    02-16 02:11:55.899 547-571/? W/PackageManager: Unknown permission com.android.voicemail.permission.READ_VOICEMAIL in package com.google.android.gms

     

     

    2-16 02:24:57.469 816-1698/? W/ModuleProvider: Failed to load module version: 
                                                    java.lang.IllegalArgumentException: module com.google.android.gms.flags not found
                                                        at com.google.android.chimera.container.ConfigurationManager.getModuleVersion(:com.google.android.gms:564)
                                                        at com.google.android.gms.chimera.container.ModuleProvider.query(:com.google.android.gms:1103)
                                                        at android.content.ContentProvider.query(ContentProvider.java:857)
                                                        at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
                                                        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
                                                        at android.os.Binder.execTransact(Binder.java:404)
                                                        at dalvik.system.NativeStart.run(Native Method)
    02-16 02:24:57.479 816-1698/? W/ModuleProvider: Failed to load module version after staging APKs
                                                    java.lang.IllegalArgumentException: module com.google.android.gms.flags not found
                                                        at com.google.android.chimera.container.ConfigurationManager.getModuleVersion(:com.google.android.gms:564)
                                                        at com.google.android.gms.chimera.container.ModuleProvider.query(:com.google.android.gms:1110)
                                                        at android.content.ContentProvider.query(ContentProvider.java:857)
                                                        at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
                                                        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
                                                        at android.os.Binder.execTransact(Binder.java:404)
                                                        at dalvik.system.NativeStart.run(Native Method)
    02-16 02:24:57.489 24578-24578/? W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
    02-16 02:24:57.909 24604-24630/? W/dalvikvm: VFY: unable to resolve static field 6889 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;

     

    #15956

    Nicola

    Hi,

    i tried with a native application and i send:

    {
    “to”: “/topics/background-topic-1”,
    “data”: {
    “message”: “This is a GCM Topic Message!”
    }
    }

    and the native application receive it.

    Instead with the Qt application doesn’t receive the notification! I don’t know as think. Please help me, i’m blocked!!!

Viewing 13 posts - 1 through 13 (of 13 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support