react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Android Timestamp Showing- 26-Jan-1970 in Some Android Device

Open Akilramki opened this issue 3 years ago • 1 comments

If we Trigger the Schedule Notification from Firebase.We getting wrong TimeStamp from Some Android Device (26-1-1970) Currently Noted Devices: Samsung Galaxy’s , Nokia 4.1 , One Plus Code :

messaging()
  .getInitialNotification()
  .then(remoteMessage => {
    if (remoteMessage) {
      console.log(
        'Notification caused app to open from quit state:',
        remoteMessage.notification,
      );
    }
  });
  
  messaging().onMessage(async remoteMessage => {
  Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));
  console.log(JSON.stringify(remoteMessage))
});


// Register background handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Message handled in the background!', remoteMessage);
});

messaging().onNotificationOpenedApp(remoteMessage => {
  console.log(
    'Notification caused app to open from background state:',
    remoteMessage.notification,
  );
});

Output :

{"collapseKey": "com.firebasetest", "data": {}, "from": "606529", "messageId": "0:16588086484686%3c41be66e66", "notification": {"android": [Object], "body": "HURRY!", "title": "Flat off"}, "sentTime": 2147483647, "ttl": 2419200}

sentTime": 2147483647

console.log(moment(2147483647).format('DD-MMM-YYYY')); // "26-Jan-1970"

Akilramki avatar Jul 26 '22 04:07 Akilramki

Hmm - that's unexpected, if that's only on firebase-android-sdk you might want to follow up with them over at https://github.com/firebase/firebase-android-sdk/, as that appears to be the sent time but this behavior makes me think it is on the device and the device clock is incorrect for whatever reason

https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/RemoteMessage#getSentTime()

You may need to produce a native reproduction based on https://github.com/firebase/quickstart-android/tree/master/messaging

mikehardy avatar Jul 30 '22 20:07 mikehardy

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

github-actions[bot] avatar Dec 05 '22 19:12 github-actions[bot]