give some time to service to start in UploadQueue

This commit is contained in:
Milos Kozak 2017-04-14 16:00:21 +02:00
parent a5d10708e6
commit 7aa2aa4d24

View file

@ -40,11 +40,16 @@ public class UploadQueue {
if (NSClientService.handler == null) {
Context context = MainApp.instance();
context.startService(new Intent(context, NSClientService.class));
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
}
}
public static void add(final DbRequest dbr) {
startService();
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
@ -57,9 +62,11 @@ public class UploadQueue {
}
});
}
}
public static void clearQueue() {
startService();
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
@ -69,9 +76,11 @@ public class UploadQueue {
}
});
}
}
public static void removeID(final JSONObject record) {
startService();
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
@ -91,9 +100,11 @@ public class UploadQueue {
}
});
}
}
public static void removeID(final String action, final String _id) {
startService();
if (NSClientService.handler != null) {
NSClientService.handler.post(new Runnable() {
@Override
public void run() {
@ -101,6 +112,7 @@ public class UploadQueue {
}
});
}
}
public String textList() {
String result = "";