Open superainovacoes opened 5 years ago
the plugin was using deprecated method, but master branch uses the new recommended way, so, can you try with master branch and see if it works?
updated the config.xml with master branch
<plugin name="phonegap-plugin-push" spec="https://github.com/phonegap/phonegap-plugin-push#master" />
but the problem is not solved, the behaviour is the same as mentioned before
Got the same problem, nothing triggers on notification, registration is working. Tested with iOS12 + iPhone XS. I don't see any commits in master branch to fix this problem.
Tested also with the master branch, no success. Android works ok.
I got it working with version 2.2.3. The problem was with new Xcode10 (mojave). For some reason Xcode10 was not able to start the app in the phone after deployment with provisioning profile, I just got message “iPhone has denied the launch request”. After changing the launch options Product -> Scheme --> Edit Scheme --> Info --> Launch: "Wait for executable to be launched". Tested getting notification when app is open and closed. Both cases notification received. .on('notification') event triggered when the app is open. When the app is closed, clicking the notification opens the app, but does not trigger the .on('notification') event, but that is by design. Remember, you need to sign the app with provisioning profile to be able to receive notifications.
I'm currently traveling a bunch for work so I'm not sure when I'm going to get a chance to sit down and really test things out with iOS 12 so anyone who can jump in here it would be greatly appreciated.
I have now tested this plugin with iOS12 and it works properly. Just realised that the .on('notification') even triggers when the app is totally closed, I didn't know this was possible, as just tested all scenarios and its working both android and iOS. So my issues were something else which described earlier in this thread. @superainovacoes is the creator of this issue so he will need to continue from here. Thanks for the great plugin!
@tavikukko i just can't choose the xcode version, i'm using phonegap build. Can you please share your fcm payload or the steps, so i can test it again? Have you tried the version 2.2.3 or the master branch?
I use Xcode to build locally and use the version 2.2.3, not the master branch. I'm not using fcm, I'm using Azure Notification Hub to send the messages. This is the payload:
{ "aps": { "alert": "title of the notification", "sound": "cat.caf" }, "title": "title of the notification", "message": "message of the notification" }
iOS Version: 12.1 Android Version: 8.0.0 Both apps are signed to production. Tested with config.xml
<!-- https://build.phonegap.com/current-support -->
<preference name="phonegap-version" value="cli-8.0.0" />
<platform name="android">
<preference name="android-build-tool" value="gradle" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="19" />
<plugin name="phonegap-plugin-push" spec="2.1.3" />
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
<platform name="ios">
<plugin name="phonegap-plugin-push" spec="2.2.3" />
<resource-file src="GoogleService-Info.plist" />
</platform>
</widget>
FCM url tested https://fcm.googleapis.com/fcm/send FCM docs https://firebase.google.com/docs/cloud-messaging/http-server-ref
{
"notification":{
"sound": "default",
"title": "title",
"body": "body",
"someKey" : "someValue"
},
"data": {
"sound": "default",
"title": "title",
"body": "body",
"someKey" : "someValue"
},
"registration_ids": ["fcY..CpM", "fQTm..GB1"],
"priority": "high",
"content_available": true,
"mutable_content": true
}
{
"data": {
"sound": "default",
"title": "title",
"body": "body",
"someKey" : "someValue"
},
"registration_ids": ["fcY..CpM", "fQTm..GB1"],
"priority": "high",
"content_available": true,
"mutable_content": true
}
{
"notification":{
"sound": "default",
"title": "title",
"body": "body",
"someKey" : "someValue"
},
"registration_ids": ["fcY..CpM", "fQTm..GB1"],
"priority": "high",
"content_available": true,
"mutable_content": true
}
Having a similar issue where the plugin is registering fine. I receive notifications when the app is in the background, but .on('notification') never fires on cold start or when the app is in the foreground.
On iOS and Android the plugin works fine for me, but on iOS on('notification') doesn't seem to be fired if the app is in foreground... i am sending test notifications from FCM console, any solutions?
Same problem here, registration is ok but .on(‘notification’) doesn't seem to be fired. I sent playload using APNs that worked fine with previous versions of this plugin. Tested in a ios12 - iphone X cordova ios 4.5.5 plugin version: 4.2.3 (even with a master branch) using Xcode no error in log
Any idea to solve it?
seems like setting the FirebaseAppDelegateProxyEnabled value to YES in info.plist might help
I am seeing the same problem with my app on iOS devices. Has anyone confirmed setting FirebaseAppDelegateProxyEnabled value to YES resolves the issue? If so, how do I set that value in the info.plist if I am using Phonegap Build?
@gregor-srdic care to expand on that?
FirebaseAppDelegateProxyEnabled should be enabled by default and is used for Swizzling. If you were to disable it you need to map your APNs token to your RCM registration token.
We were running into a similar issue where everything worked fine in iOS 11, but in iOS 12 it was not working. It turned out that in PushNotification.init() we never were setting any of the permissions (alert/sound/badge). For whatever reason we never ran into issues with this in older iOS versions, but in iOS 12 it wouldn't work. After setting the option in ios for alert: true in the init things began working again as expected.
Note we also had to use Legacy build, in iOS go to File -> Workspace Settings... -> In Shared Workspace Settings set Build System to 'Legacy Build System'.
https://webappcodes.com/tag/notification
ios pushnotification implementation
Hi, I have retested. We are using phonegap-build. App is signed to release. The tests include setting "FirebaseAppDelegateProxyEnabled" to YES and NO to plist.
config.xml
<preference name="phonegap-version" value="cli-8.1.1" />
<preference name="pgb-builder-version" value="2" />
<platform name="android">
<engine name="android" spec="7.1.4" />
<preference name="android-minSdkVersion" value="21" />
<preference name="android-targetSdkVersion" value="26" />
<feature name="http://api.phonegap.com/1.0/notification" />
<plugin name="phonegap-plugin-push" source="npm" spec="2.2.3" />
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
<platform name="ios">
<engine name="ios" spec="4.5.5" />
<feature name="http://api.phonegap.com/1.0/notification" />
<plugin name="phonegap-plugin-push" source="npm" spec="2.2.3" />
<resource-file src="GoogleService-Info.plist" />
</platform>
build.json
{
"ios": {
"debug": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"release": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}
app.js
PushNotification.init({
android: {
sound: "true",
vibrate: "true",
forceShow: "true",
icon: "icon"
},
ios: {
alert: "true",
sound: "true"
}
});
POSTMAN (https://fcm.googleapis.com/fcm/send)
{
"to": "f76M.......ICWd",
"priority": "high",
"content_available": true,
"mutable_content": true,
"notification": {
"body": "body not",
"title": "title not",
"sound": "default",
"custom1_not": "val_not"
},
"data": {
"body": "body data",
"title": "title data",
"sound": "default",
"custom1_data": "val_data"
}
}
Same problem, iOS 12 can't receiver event ".on('notification')" when the APP is OPEN.
Same issue here, the .on('notification') callback is never called on iOS (I tried with iOS10 and iOS12, none of them worked). I'm using FCM for iOS. I can receive the push notifications when the app is in background, but the callback isn't called when clicking it or if the app is in foreground when the notification is received.
I tried all the suggestions in this issue: I'm using Legacy Build System, I added FirebaseAppDelegateProxyEnabled to the .plist file and I also set Launch: "Wait for executable to be launched". Nothing worked, the callback isn't called.
I'm using fcm-node to test this:
notification: {
title: 'John Smith',
body: 'Message',
priority: 'high',
}
I tried using priority and content_available params, with no success.
Has anyone been able to make this work in iOS using FCM?
Seems like the problem is inside the plugin (with ios version). Even sending the push using fcm site (https://console.firebase.google.com/u/0/project/~appname~/notification/compose), the notification doesn't trigger when app is opened or background, only when is full closed.
The problem seems to be here even using new cordova ios@5.0.0 version. The .on(‘notification’) event doesn't seem to be fired. I’m using APNs, “notification” doesn’t work in background, foreground and open status..
I got same problem with ios 12 with xcode 10.1. register works fine, but can't receive any push message, but it works on android. anyone can help me?
On File->Workspace Settings -> Shared Workspace Settings -> BuildSystem:
If we select New Build System, we are not able to receive Push.
On IOS 10, selecting Legacy Mode, we are able to receive Push normally.
On IOS 12, selecting Legacy Mode, it´s not 100% functional (it´s intermitent)
yes, I figured out, need to update xcode build as Legacy System.
Following up my previous comment, I was able to make the callback work when the app is in foreground by using the branch in this Pull Request:
https://github.com/phonegap/phonegap-plugin-push/pull/2581
The callback still isn't called when I click a background notification, but I noticed that the same happens with version 1.11.1 of the plugin so it seems this has been broken for a long time.
@dpalou even with branch from the pull request you specified, using iOS 12.1, cordova 7.1.0, cordova-ios 4.5.5, APNS (not FCM), XCode 10 (using build Legacy System), the on("notification") trigger is not fired in background or foreground, but the push is received when in background and the on("registration") trigger is fired.
Hi,
I have the same problem. I can normally register in FCM, the firebase recognizes the device, but when I send the push I do not get even in the foreground background. When i change the workspace settings to Legacy mode, works correctly.
Ionic:
ionic (Ionic CLI) : 4.3.1 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.2.2
Cordova:
cordova (Cordova CLI) : 8.0.0 Cordova Platforms : ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-webview 3.1.2, (and 15 other plugins)
System:
ios-deploy : 1.9.2 ios-sim : 5.0.13 NodeJS : v8.12.0 (/usr/local/bin/node) npm : 6.4.1 OS : macOS Mohave Xcode : Xcode 10.1 Build version 10B61 Ios: 12.1.4
Any solution?
No solution yet... isn’t it?
same issue still exists with master branch is there any help/solution? we tried to add FirebaseAppDelegateProxyEnabled to info.plist and phonegap-plugin-push build 2.2.3
we are building the app via adobe phonegap build
Any progress on this issue?
same problem here
Expected Behaviour
Receive push when app is opened or closed and .on('notification') get fired when app is opened or closed
Actual Behaviour
Can't peceive push when app is opened or closed and .on('notification') is not fired when app is opened or closed
Reproduce Scenario (including but not limited to)
Steps to Reproduce
see payload
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iOS 12
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
Cordova CLI version and cordova platform version
IOS phonegap build version cli-8.0.0 phonegap cordova ios version 4.5.4
Android phonegap build version cli-8.0.0 phonegap cordova android version 7.0.0
Plugin version
phonegap-plugin-push version 2.2.3
Sample Push Data Payload
URL POST https://fcm.googleapis.com/fcm/send
1 app is closed, no push received app is open, no push received
2 app is closed, push received, when click push "notification" not fired app is open, no push received
Sample Code that illustrates the problem
Logs taken while reproducing problem
no log, app is build on "phonegap build" and being deployed to appstore on testflight for production