mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
implement basic poll
This commit is contained in:
@@ -169,7 +169,8 @@ public class ApplicationLoader extends Application {
|
||||
// start keep-alive service that restarts the app as soon it is terminated
|
||||
// (this is done by just marking the service as START_STICKY which recreates the service as
|
||||
// it goes away which also inititialized the app indirectly by calling this function)
|
||||
applicationContext.startService(new Intent(applicationContext, KeepAliveService.class));
|
||||
|
||||
//applicationContext.startService(new Intent(applicationContext, KeepAliveService.class));
|
||||
|
||||
// init locale
|
||||
try {
|
||||
|
||||
@@ -29,6 +29,9 @@ import android.app.Application;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.Utilities;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@@ -85,6 +88,8 @@ public class ForegroundDetector implements Application.ActivityLifecycleCallback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MrMailbox.connect();
|
||||
}
|
||||
|
||||
public boolean isWasInBackground(boolean reset) {
|
||||
@@ -111,6 +116,12 @@ public class ForegroundDetector implements Application.ActivityLifecycleCallback
|
||||
|
||||
}
|
||||
}
|
||||
Utilities.searchQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MrMailbox.disconnect();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TimerReceiver extends BroadcastReceiver {
|
||||
Utilities.searchQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MrMailbox.heartbeat();
|
||||
MrMailbox.poll();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user