venazco
December 14, 2022, 10:44am
1
I am using the plugin: @havesource /cordova-plugin-push
App not opening when click on push.
This happens on mobiles with Android 12 and Android 13.
My android-targetSdkVersion in the config.xml is 31.
Tested plugin version: 3.0.1 and 4.0.0-dev.0
I would like to know if someone else works correctly under the same conditions as me, so I can know if the problem is in the plugin itself or in my code.
My JS Code:
document.addEventListener('deviceready', onDeviceReady, false);
document.addEventListener('resume', onDeviceReady, false);
function onDeviceReady() {
const push = PushNotification.init({
android: {
},
ios: {
alert: "true",
badge: "true",
sound: "true",
clearBadge: "true"
}
});
push.on('registration', (data) => {
document.getElementById("regId").value = data.registrationId;
});
push.on('notification', (data) => {
//console.log(data.message);
//console.log(data.title);
//console.log(data.count);
//console.log(data.sound);
//console.log(data.image);
//console.log(data.additionalData);
});
push.on('error', (e) => {
// e.message
});
document.addEventListener("backbutton", onBackKeyDown, false);
// Cordova is now initialized. Have fun!
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
}
ghenne
December 14, 2022, 2:41pm
2
I’ve never used this plugin myself - but have you tried remote debugging to see if there are any errors on the console?
opened 04:10AM - 31 Oct 21 UTC
Hello,
Using cordova android 10.1.1 platform and the dev version of the plugi… n (unstable) because 2.0 does not compile with android 10. The problem is that push notifications don't open the app when tapping on the notification. This is what adb logcat shows,
When the push notification is received (This one goes away when adding notId to the payload but same problem)
10-31 05:59:59.263 19765 19928 E cordova-plugin-push (FCMService): Exception occurred when parsing notId: null
When trying to open the app from the push notification
10-31 06:47:33.341 2020 5370 W ActivityTaskManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { flg=0x24000000 cmp=HERE GOES MY APP ID/com.adobe.phonegap.push.PushHandlerActivity (has extras) }
10-31 06:00:26.281 2020 2043 E system_server: Invalid ID 0x00000000.
Before upgrading to version 10 this problem did not exist.
Thank you.
This is the log when trying to build using version 2 (stable)
````Some problems were found with the configuration of task ':app:processDebugGoogleServices' (type 'GoogleServicesTask').
- In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'intermediateDir' without corresponding getter has been annotated with @OutputDirectory.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'intermediateDir'.
2. Remove the annotations on 'intermediateDir'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR1' without corresponding getter has been annotated with @Input.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'packageNameXOR1'.
2. Remove the annotations on 'packageNameXOR1'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR2' without corresponding getter has been annotated with @Input.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'packageNameXOR2'.
2. Remove the annotations on 'packageNameXOR2'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'quickstartFile' without corresponding getter has been annotated with @InputFile, @Optional.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'quickstartFile'.
2. Remove the annotations on 'quickstartFile'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'searchedLocation' without corresponding getter has been annotated with @Input.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'searchedLocation'.
2. Remove the annotations on 'searchedLocation'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
````
Maybe that, otherwise I’d raise an issue in their github.
venazco
December 15, 2022, 2:10pm
4
Thanks for the help.
I have already been able to solve it by modifying the payload:
$message = array(
'title' => $nombreCole,
'body' => $message,
'icon' => 'fcm_push_icon',
'color' => $color,
'badge' => '1',
'sound' => 'default'
//'click_action' => 'FCM_PLUGIN_ACTIVITY'
);
Simply commenting out the ‘click_action’ already works!
ghenne
December 15, 2022, 2:42pm
5
Tip : If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)