Comments (14)
Sorry I hadn't seen your follow up comment. Let me investigate further. I'll get back to you once I find the source of the bug.
from talkjs-flutter.
Hi,
Unfortunatley it's not possible to use Firebase messaging on iOS and APNS at the same time.
On iOS TalkJS uses APNS for push notifications, and cannot use Firebase.
So:
If you urgently need to fix this problem, my suggestion would be to fork this project, remove the flutter_apns_only
dependency, and all the APNS related stuff from notification.dart
.
Keep in mind that doing so disables the push notifications for TalkJS.
from talkjs-flutter.
Actually, it's impossible because I need notifications.
Maybe you have other thoughts? Do I have to replace all my FCM with APNS?
from talkjs-flutter.
If replacing FCM with APNS is an option for you, then it's absolutely the way to go
from talkjs-flutter.
However, maybe there are some other decisions?
Actually as I see I can get notifications in foreground but FirebaseMessaging.onBackgroundMessage
. It isn't called and I can't get any of data in background. But notifications are shown correctly.
And I am sorry for misleading, after some research I found that the following code doesn't break FCM. But only I add talkjs again to my project, FirebaseMessaging.onBackgroundMessage
stops being called.
<key>flutter_apns.disable_swizzling</key>
<true/>
I'm not well in it, so could you please help me and clarify if it can be fixed? Or what do I have to do? Give me the direction, please.
Thanks
from talkjs-flutter.
Hey there, my name is Victor. I'm a developer here at TalkJS. The setting you highlighted that disables swizzling is only necessary if you DO NOT need Firebase messaging for iOS push notifications. link. So in your case, you should remove this from your Info.plist
.
Regarding, FirebaseMessaging.onBackgroundMessage
not getting called, could you share with me a sample of the json data you are sending to Firebase so that I can help debug the issue.
from talkjs-flutter.
Hi Victor @vickz84259,
if I don't use disable_swizzling, I get an error Firebase PlatformException(channel-error, unable to establish connection on channel., null, null)
and firebase_messaging doesn't work at all.
This is full data from FirebaseMessaging.onMessage
when the app is opened. Do you need this one?
{
senderId: null,
category: null,
collapseKey: null,
contentAvailable: true,
data: {
body: {
"callType": "EMERGENCY",
"callId": 231,
"type": "client_create_call",
"callInfo": {
"questSubj": "..."
},
"clientDetails": {
"firstName": "...",
"lastName": "..."
},
"isSilent": false
}
},
from: null,
messageId: 1688656717966683,
messageType: null,
mutableContent: true,
notification: {
title: "...",
titleLocArgs: [],
titleLocKey: null,
body: "...",
bodyLocArgs: [],
bodyLocKey: null,
android: null,
apple: {
badge: null,
subtitle: null,
subtitleLocArgs: [],
subtitleLocKey: null,
imageUrl: null,
sound: null
},
web: null
},
sentTime: null,
threadId: null,
ttl: null
}
from talkjs-flutter.
if I don't use disable_swizzling, I get an error Firebase PlatformException(channel-error, unable to establish connection on channel., null, null) and firebase_messaging doesn't work at all.
Give me a moment as I confirm the exact scenario under which this happens.
This is full data from FirebaseMessaging.onMessage when the app is opened. Do you need this one?
Nope. I need the json data your server sends to Firebase. Not what Firebase sends to the device.
from talkjs-flutter.
Thanks Victor.
Backend developer told me that he used fb api to form the request.
He gave me this code of the forming. And he will try to find the way to log json api tomorrow if it is necessary. But maybe now it will be useful.
ApnsConfig
apnsConfig=ApnsConfig.builder().setAps(Aps.builder().setMutableContent(true).setContentAvailable(true).build()).build();
MulticastMessage msg = MulticastMessage.builder()
.addAllTokens(tokens).setApnsConfig(apnsConfig)
.putData("body", mapper.writeValueAsString(data))
.setNotification(notification)
.build();
BatchResponse res= fcm.sendMulticast(msg);
from talkjs-flutter.
First of all my apologies. When I said:
The setting you highlighted that disables swizzling is only necessary if you DO NOT need Firebase messaging for iOS push notifications. So in your case, you should remove this from your Info.plist.
I was wrong. My assumption was that that key disables swizzling even for the FirebaseMessaging module. However it onlly disables swizzling for flutter_apns
. So you should have the key in your Info.plist
.
Regarding FirebaseMessaging.onBackgroundMessage
not getting called, this is an issue with the payload being sent to Firebase. Without having content-available: 1
and mutable-content: 1
in your payload for iOS. The background message handler won't get called.
You can read more here: firebase/flutterfire#9381 and https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2943360
from talkjs-flutter.
But as you can see from my comment the backend developer enabled both content-available
and mutable-content
.
And as I mentioned in the other comment, FirebaseMessaging.onBackgroundMessage
works great until I add talkjs-flutter package into my application.
Once I remove it from pubspec.yaml
file, call flutter pub get
and restart my application FirebaseMessaging.onBackgroundMessage
works fine!
I can say the same about swift method in ios/Runner/AppDelegate.swift
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Foundation.Data) {
Messaging.messaging().apnsToken = deviceToken
print("DEVICETOKEN", deviceToken)
super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
I see the printed message in console when there are no talkjs package in my app. And the message stops showing when I add it.
So it seems a problem in blocking background notification methods by the talkjs-flutter package. Could you tell me, what you think about it?
from talkjs-flutter.
Hi Victor @vickz84259, could you please tell me the status? It's really urgent one
from talkjs-flutter.
@vickz84259 Hi Victor,
Sorry for pushing but I would like to know status of the task. Could you clarify please?
from talkjs-flutter.
@vickz84259 Hello, Victor! Any updates on this issue?
from talkjs-flutter.
Related Issues (14)
- Bug in iphone HOT 15
- NavigationDelegate for handling links inside chat HOT 3
- talkjs lib broke Firebase lib on iOS HOT 9
- Need customising webview color and keyboard color HOT 8
- ChatBox.messageField.enterSendsMessage doesn't work
- Do you have a plan to support Windows platform? HOT 3
- Need firebase versions update. iOS PlatformException while using Firebase (versions conflict) HOT 1
- Firebase PlatformException(channel-error, unable to establish connection on channel., null, null) HOT 2
- No push notifications until ChatBox widget created HOT 2
- Push notifications from another user HOT 1
- [Android] No push notifications while app is killed HOT 1
- No way to logout/end a session HOT 1
- Flutter SDK always loading in flutter module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from talkjs-flutter.