Hi @EddyVerbruggen ,
having big trouble with this plugin regarding push notifications. It is really really frustrating so far and i really hate NativeScript right now. It is not possible with this plugin to receive (data) notifications when the app is in background? Any help would be appreciated.
(Data)Notifications are incoming if the app is in foreground
If the app is in background, the notifications seem to be processed by iOS but are received in the app only if the app is started (foreground), this is logged in XCode Debug Console:
2018-03-23 13:25:34.156341+0100 MyApp[14310:11690264] Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.
What is wrong. Please help.
BR Lacos
I'm not entirely sure this is the best way to report an issue on my OSS repo. And without sharing your project it's impossible to say anything useful.
Have you looked at this
Make sure you [require the plugin in app.ts]
before application.start(), and do init() after the app has started (not in app.ts - not even in a timeout; move it out of app.ts entirely!).
Make sure to use
require, notimportinapp.tsbecause TSC will remove the import in case you're not using it.
Hi,
I have done that. I think it is a general problem with this plugin oder implementation.
I have checked out your demo app @EddyVerbruggen an this app behaves the same.
The push-notifications (data only) are processed by the app on startup - not in background mode.
What is wrong? I have written a demo in Objective C (based on the Demo Code from Firebase) and that is running as desired - with background notifications.
The intention was to save time with Nativescript while developing for both platforms. But it seems quite to be the contrary :/
Here a push notification send by curl, for example:
{
"to":"<token>",
"priority": "high",
"content_available": true,
"data":{
"title":"mytitle",
"body":"mybody",
"url":"myurl"
}
}
Any help would be very appreciated.
BR,
Lacos
Please stop complaining and start being constructive. Again, share your project if you want any remotely helpful reply by me on this subject.
Hi @EddyVerbruggen , sorry for complaining but it is very frustrating so far.
I can't post the sources since it is a commercial app. I can try to strip down that and email you, for example.
The same problem occured if I tried your demo app. Are you sure that background notifications on ios are supported by the implementation in general?
BR,
Lacos
@Lacos247 I understand it's frustrating but it's of no use repeatedly telling me. Please just focus that energy towards finding a solution.
Of course it works for me, and I've helped many others getting it to work and it's always either a problem with their project setup or the way they are sending notifications.
If the demo app doesn't work then make sure you're using the curl command I added to the readme.
@EddyVerbruggen
Yes you are right with the energy - sorry.
I have build your demo app and connected to my ios dev account.
The curl commands work, if the app is in foreground. If the app is in background only the commands work which include the messages-block, but this way it is not supposed to work. The data-message only commands do not work but they are passed instantly if the app is started again.
In my opinion the app should be able to process/edit the message and show it (with your local notifications plugin), for example on their own. Is that plugin supporting that?
BTW: On Android everything ist fine and works ad desired.
BR,
Lacos
Hi @EddyVerbruggen ,
I have send you an email with the small project attached. I hope you can help me and find my mistake.
BR,
Lacos
If it would be helpful, you can take a look at Yowwlr, which recently received a PR to make background notifications work
https://github.com/jlooper/Yowwlr
this is the change Shiva made to enable background push - note, I haven't thoroughly tested this but maybe it will help you
Hi Jen,
many thanks for the information. I will try that.
BR,
Lacos
Hi all,
the demo app from Eddy seems to work (at least with the 5.2.0 plugin Version). I got it running and got background notifications on iOS.
What not works for me right now is a NativeScript-Angular-App with the push notification plugin.
If the app is in foreground, everything works fine. If the app is in background, the callback is not triggered.
In my opinion I have followed your best practices:
My test messages (works with Eddys Demo above):
curl -X POST --header "Authorization: key=
@EddyVerbruggen
I have send you a demo. It would be great if you could look at it and give some tips. What ist wrong?
BR,
Lacos
Any updates on success? I'm also facing no background notification for iOS ns angular project.
Also having this problem; NS/Angular/Typescript using nativescript-plugin-firebase. as shown in the demo app, i am adding the appropriate "require()" in both main.ts and main.aot.ts, as well as using the ngOnInit() for my app.component.ts to run the firebase.init(). Android receives messages both foreground and background, with background appropriately generating system notices. iOS 11 on iPhone X receives the messages both foreground and background, but does not generate system notifications in background -- neither on-screen notification or entries in the notification center.
has anyone found a solution/gotcha for this?
resolved, for me at least. this is a simple firebase configuration oversight in most cases. highly recommend this guide:
https://firebase.google.com/docs/cloud-messaging/ios/certs
if your key file config for your ios app in firebase is not 100% you might have most of the push notice functionality and still be missing system notifications. check this guide and follow all steps if this sounds like your problem.
also keep in mind your ios emulator will never receive system notices for push messages; you must install on a real device to see these.
worth considering some extra attention in the main docs, considering how many people jump into this undereducated on the overall process (like me).
@bniehuser It's not very clear to me what you're missing exactly. Mind doing a PR?
sorry eddy, had nothing to do with your wonderful code... was missing the cert chain (.p8 file) in the firebase config, which strangely still allows the app to receive messages directly but does not allow the actual iOS notifications. figured this could be added to an faq or something for noobs like me who missed this step so they don't complain to you for their own oversight ;)
I'll take a look and see if there's a good spot to reference this issue in your writeup and submit a pr. thanks!
@bniehuser Hi, can i ask you a question. i have the same background - issue (system-notification not displayed) on iphone x. But ONLY iPhone X other iPhones work fine.
Was that the same for you and regenerating the cert-files like described helped. Or did it not work on any iPhone?