Optimize FCM token refreshing

This commit is contained in:
Lasantha Dharmakeerthi 2024-12-02 06:16:31 +00:00
commit 9e34ec99aa

View File

@ -62,7 +62,7 @@ public class FCMNotificationStrategy implements NotificationStrategy {
Device device = FCMDataHolder.getInstance().getDeviceManagementProviderService() Device device = FCMDataHolder.getInstance().getDeviceManagementProviderService()
.getDeviceWithTypeProperties(ctx.getDeviceId()); .getDeviceWithTypeProperties(ctx.getDeviceId());
if(device.getProperties() != null && getFCMToken(device.getProperties()) != null) { if(device.getProperties() != null && getFCMToken(device.getProperties()) != null) {
FCMUtil.getInstance().getDefaultApplication().refresh(); FCMUtil.getInstance().getDefaultApplication().refreshIfExpired();
sendWakeUpCall(FCMUtil.getInstance().getDefaultApplication().getAccessToken().getTokenValue(), sendWakeUpCall(FCMUtil.getInstance().getDefaultApplication().getAccessToken().getTokenValue(),
getFCMToken(device.getProperties())); getFCMToken(device.getProperties()));
} }