You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (remoteMessage.data.containsKey(Constants.KEY_HEARTBEAT_ID)) {
23
+
Timber.w("received heartbeat message with ID [${remoteMessage.data[Constants.KEY_HEARTBEAT_ID]}] and priority [${remoteMessage.priority}] and original priority [${remoteMessage.originalPriority}]")
24
+
sendHeartbeat()
25
+
return
26
+
}
27
+
21
28
val messageID = remoteMessage.data[Constants.KEY_MESSAGE_ID]
22
29
if (messageID ==null) {
23
30
Timber.e("cannot get message id from notification data with key [${Constants.KEY_MESSAGE_ID}]")
@@ -45,6 +52,23 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
45
52
}
46
53
// [END on_new_token]
47
54
55
+
privatefunsendHeartbeat() {
56
+
Timber.d("sending heartbeat from FCM notification")
57
+
if (!Settings.isLoggedIn(applicationContext)) {
58
+
Timber.w("user is not logged in, not sending heartbeat")
Copy file name to clipboardExpand all lines: api/pkg/services/heartbeat_service.go
+39-5Lines changed: 39 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ import (
19
19
20
20
const (
21
21
// select id, a.timestamp, a.owner, a.timestamp - (SELECT timestamp from heartbeats b where b.timestamp < a.timestamp and a.owner = b.owner and a.user_id = b.user_id order by b.timestamp desc limit 1) as diff from heartbeats a;
ctxLogger.Info(fmt.Sprintf("sending missed heartbeat notification for userID [%s] and owner [%s] and monitor ID [%s]", params.UserID, params.Owner, params.MonitorID))
ctxLogger.Info(fmt.Sprintf("successfully sent heartbeat FCM [%s] to phone with ID [%s] for user [%s] and monitor [%s]", result, payload.PhoneID, payload.UserID, payload.MonitorID))
81
+
returnnil
82
+
}
83
+
50
84
// PhoneNotificationSendParams are parameters for sending a notification
0 commit comments