- m.refreshPreKeys();
-
- m.requestSyncGroups();
- m.requestSyncContacts();
- m.requestSyncBlocked();
- m.requestSyncConfiguration();
+ try (SignalAccount account = SignalAccount.createLinkedAccount(pathConfig.getDataPath(),
+ username,
+ ret.getUuid(),
+ password,
+ ret.getDeviceId(),
+ ret.getIdentity(),
+ registrationId,
+ signalingKey,
+ profileKey)) {
+ account.save();
+
+ try (Manager m = new Manager(account, pathConfig, serviceConfiguration, userAgent)) {
+
+ try {
+ m.refreshPreKeys();
+ } catch (Exception e) {
+ logger.error("Failed to refresh prekeys.");
+ throw e;
+ }
+
+ try {
+ m.requestSyncGroups();
+ m.requestSyncContacts();
+ m.requestSyncBlocked();
+ m.requestSyncConfiguration();
+ } catch (Exception e) {
+ logger.error("Failed to request sync messages from linked device.");
+ throw e;
+ }
+
+ m.close(false);
+ }