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