Open thoth-nexlesoft opened 7 years ago
if there is no code change, something is happening with Firebase?
This is payload when server push notification:
const object = {
"id": "4",
"title": "Test Title 182",
"content": "Test content",
"type": "info",
"date": "2017-08-22",
"shop": "Pizza",
"user_id": "8",
}
const payload = {
data: object,
notification: {
"sound": "default",
"body" : object.content,
"title" : object.title,
"icon": "ic_notification"
}
}
And this data app has been received notification:
{ user_id: '8',
collapse_key: 'com.biits.managedev',
date: '2017-08-22',
from: '123456',
notification:
{ e: '1',
sound2: 'default',
sound: 'default',
icon: 'ic_notification',
title: 'Test Title 182',
body: 'Test content' },
type: 'info',
content: 'Test content',
title: 'Test Title 182',
id: '4',
shop: 'Pizza',
finish: [Function: finish] }
I don't know why app has been received notification with properties e: '1', sound2: 'default',
@evollu
e is created by fcm, not sure about sound2. you said you can't receive notification, so what is data you received? foreground?
what is you OS?
But app wasn't been received notification on yesterday
banner not showing up or callback not called
The notification above, app has been received when I downgrade react-native-fcm@6.2.3 app only is been received notification foreground state. @evollu
But app wasn't been received notification on yesterday
Is banner not showing up or callback not called?But when I I downgrade react-native-fcm@6.2.3 and 'Firebase/Messaging', '3.17.0' when app has been received notification with issue duplicate notification. @evollu
FCM < 4 has direct connection socket open automatically so you can receive notification foreground. The problem should be notification certificate setup. Can you reproduce with example project?
Can you sure the example project is receive notification at foreground, background and kill app at the moment? @evollu
yep it works for me
I have created again certificate and export .p12 file, I have imported on firebase. But app isn't been received notification. I tried push notification token type with firebase server.
try APNs Auth Key?
I have try APNs Auth Key but app isn't been received notification too.
if you are using iOS11, try latest repo. otherwise, try the native example from Firebase (quickstart-ios) and see if you can receive notification.
I have received notification with example native code project https://github.com/firebase/quickstart-ios/tree/master/messaging
I try with IOS 10.3.3 anh IOS 11
I don't receive notification with example fcm project too when I send global notification through firebase console.
And I don't see log receive notification from the methods
+ (void)didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull RCTRemoteNotificationCallback)completionHandler {
NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: userInfo];
NSLog(@"didReceiveRemoteNotification data: %@", data);
[data setValue:@"remote_notification" forKey:@"_notificationType"];
[data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"];
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:@{@"data": data, @"completionHandler": completionHandler}];
}
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification {
NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: notification.userInfo];
NSLog(@"didReceiveLocalNotification data: %@", data);
[data setValue:@"local_notification" forKey:@"_notificationType"];
[data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"];
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:@{@"data": data}];
}
+ (void)didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(nonnull RCTNotificationResponseCallback)completionHandler
{
NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: response.notification.request.content.userInfo];
NSLog(@"didReceiveNotificationResponse data: %@", data);
[data setValue:@"notification_response" forKey:@"_notificationType"];
[data setValue:@YES forKey:@"opened_from_tray"];
if (response.actionIdentifier) {
[data setValue:response.actionIdentifier forKey:@"_actionIdentifier"];
}
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:@{@"data": data, @"completionHandler": completionHandler}];
}
+ (void)willPresentNotification:(UNNotification *)notification withCompletionHandler:(nonnull RCTWillPresentNotificationCallback)completionHandler
{
NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: notification.request.content.userInfo];
NSLog(@"willPresentNotification data: %@", data);
[data setValue:@"will_present_notification" forKey:@"_notificationType"];
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:@{@"data": data, @"completionHandler": completionHandler}];
}
Please check again example project. @evollu
try the latest example in master branch and send notification through the app by clicking the button. You will need to replace the FirebaseConstant.js and GoogleService-Info.plist file with your own match ones
mine works fine
I have received notification with example project, but I don't receive notification with my project. I have upgraded react-native-fcm latest, and run again pod install.
I can get token but Appdelegate.m don't callback get triggered?
Have you configured more example project?
there is a change in AppDelegate.m for xcode 8/9 compatibility. Have you changed it? it is in readme
Thanks @evollu , I have downgrade pod 'FirebaseInstanceID', '2.0.0'
.
App has been received notification. But now app been received duplicate notifications, when server send one notification.
you mean the callback called multiple times? it is expected
It is bug. I'm expect show 1 notification when server send notification 1 time. But now app been received duplicate notifications, when server send one notification.
are you seeing multiple banners?
[Android] Yes, I'm only see 1 log line received notification, but notification bar show multiple banners?
are you scheduling local notification anywhere? debug this and see how many times it is called https://github.com/evollu/react-native-fcm/blob/master/android/src/main/java/com/evollu/react/fcm/SendNotificationTask.java#L46
I don't use to schedule local notification. I use to push notification with topic.
I have configured my project, app have been received notification foreground, background and kill app states (react-native-fcm@9.1.0). But app wasn't been received notification on yesterday. When I upgrade react-native-fcm@9.3.0 app isn't been receive notification too. When I downgrade react-native-fcm@6.2.3 app only is been received notification foreground state. I don't understand what's happen.
Can you help me? @evollu