give some time to service to start in UploadQueue
This commit is contained in:
parent
a5d10708e6
commit
7aa2aa4d24
1 changed files with 52 additions and 40 deletions
|
@ -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 = "";
|
||||
|
|
Loading…
Reference in a new issue