|
|
|
@ -174,12 +174,13 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MicroPhotoContext.hasMpAppConfig(appContext)) {
|
|
|
|
|
Runnable runnable = new Runnable() {
|
|
|
|
|
final Runnable runnable = new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
if (!MicroPhotoService.isRunning && !TextUtils.isEmpty(appConfig.cmdid) && !TextUtils.isEmpty(appConfig.server) && appConfig.port != 0) {
|
|
|
|
|
if (binding.btnStartServ.isEnabled()) {
|
|
|
|
|
Log.i(TAG, "Perform AutoStart");
|
|
|
|
|
binding.btnStartServ.performClick();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -189,10 +190,11 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
long timeout = 500;
|
|
|
|
|
if (SystemClock.elapsedRealtime() < 180000) {
|
|
|
|
|
// In 3 minutes
|
|
|
|
|
timeout = 30000; // in 30 seconds
|
|
|
|
|
timeout = 10000; // in 10 seconds
|
|
|
|
|
}
|
|
|
|
|
Handler handler = new Handler();
|
|
|
|
|
handler.postDelayed(runnable, timeout);
|
|
|
|
|
Log.i(TAG, "Set AutoStart after " + Long.toString(timeout) + "ms");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -232,6 +234,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
startMicroPhotoService(appContext, curAppConfig, mMessenger);
|
|
|
|
|
|
|
|
|
|
Log.i(TAG, "Service auto-started");
|
|
|
|
|
binding.btnStartServ.setEnabled(false);
|
|
|
|
|
binding.btnStopServ.setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|