use of im.actor.runtime.storage.SyncKeyValue in project actor-platform by actorapp.
the class NotificationsActor method preStart.
@Override
public void preStart() {
isMobilePlatform = config().getPlatformType() == PlatformType.ANDROID || config().getPlatformType() == PlatformType.IOS;
// Building storage
storage = new SyncKeyValue(Storage.createKeyValue(STORAGE_NOTIFICATIONS));
// Loading pending messages
pendingStorage = new PendingStorage(MAX_NOTIFICATION_COUNT);
byte[] storage = this.storage.get(0);
if (storage != null) {
try {
pendingStorage = PendingStorage.fromBytes(storage, MAX_NOTIFICATION_COUNT);
} catch (IOException e) {
e.printStackTrace();
}
}
subscribe(AppVisibleChanged.EVENT);
subscribe(PeerChatOpened.EVENT);
subscribe(PeerChatClosed.EVENT);
}
Aggregations