Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Notification received time in Android

I am using Firebase to push notification from server to a specific android device. I want to get time when notification is received (device's local time not server time). How can I get that?

Because I have to show a timer with respect to that time so that is why I need that exact time when notification received on that device.

like image 750
Zohab Ali Avatar asked May 09 '26 09:05

Zohab Ali


1 Answers

You can use this firebase function in the onMessageReceived() method:

Long time = remoteMessage.getSentTime();

Hope this helps :)

like image 139
Michele La Ferla Avatar answered May 10 '26 23:05

Michele La Ferla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!