diff --git a/app/src/main/java/ch/dissem/apps/abit/synchronization/Authenticator.java b/app/src/main/java/ch/dissem/apps/abit/synchronization/Authenticator.java index 5a6d3c3..6d4eec5 100644 --- a/app/src/main/java/ch/dissem/apps/abit/synchronization/Authenticator.java +++ b/app/src/main/java/ch/dissem/apps/abit/synchronization/Authenticator.java @@ -13,7 +13,7 @@ import android.os.Bundle; */ public class Authenticator extends AbstractAccountAuthenticator { public static final String ACCOUNT_NAME = "Bitmessage"; - public static final String ACCOUNT_TYPE = "bitmessage.dissem.ch"; + public static final String ACCOUNT_TYPE = "ch.dissem.bitmessage"; // Simple constructor public Authenticator(Context context) { diff --git a/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncAdapter.java b/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncAdapter.java index 4935e68..4bbc627 100644 --- a/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncAdapter.java +++ b/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncAdapter.java @@ -37,9 +37,12 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter { @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { - LOG.info("Synchronizing Bitmessage"); // If the Bitmessage context acts as a full node, synchronization isn't necessary - if (bmc.isRunning()) return; + if (bmc.isRunning()) { + LOG.info("Synchronization skipped, Abit is acting as a full node"); + return; + } + LOG.info("Synchronizing Bitmessage"); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext()); @@ -63,7 +66,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter { } else { port = 8444; } - long timeoutInSeconds = preferences.getInt("sync_timeout", 120); + long timeoutInSeconds = Long.parseLong(preferences.getString("sync_timeout", "120")); try { LOG.info("Synchronization started"); bmc.synchronize(InetAddress.getByName(trustedNode), port, timeoutInSeconds, true); diff --git a/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncService.java b/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncService.java index cdd0143..b3abcaf 100644 --- a/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncService.java +++ b/app/src/main/java/ch/dissem/apps/abit/synchronization/SyncService.java @@ -4,6 +4,9 @@ import android.app.Service; import android.content.Intent; import android.os.IBinder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import ch.dissem.apps.abit.listener.MessageListener; import ch.dissem.apps.abit.notification.NetworkNotification; import ch.dissem.apps.abit.repository.AndroidInventory; @@ -22,6 +25,7 @@ import static ch.dissem.apps.abit.notification.NetworkNotification.ONGOING_NOTIF * onPerformSync(). */ public class SyncService extends Service { + private static final Logger LOG = LoggerFactory.getLogger(SyncService.class); // Storage for an instance of the sync adapter private static SyncAdapter syncAdapter = null; // Object to use as a thread-safe lock diff --git a/app/src/main/res/xml/authenticator.xml b/app/src/main/res/xml/authenticator.xml index aa46bf6..17609a0 100644 --- a/app/src/main/res/xml/authenticator.xml +++ b/app/src/main/res/xml/authenticator.xml @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/app/src/main/res/xml/syncadapter.xml b/app/src/main/res/xml/syncadapter.xml index 20cacd2..fabc86f 100644 --- a/app/src/main/res/xml/syncadapter.xml +++ b/app/src/main/res/xml/syncadapter.xml @@ -1,7 +1,7 @@