I'm implementing Mobile Services for my Android App to connect to azure. I've run through the offline sync tutorial and that works fine.
I've now tried to implement the same method in my app with a different table and I get a Push Exception. Funny thing is that it still gets inserted into the online database. Anyone got a clue why this is happening?
As a test, I implemented the same class, tables, etc in the ToDoItem project without error.
Exception below
W/System.err: java.util.concurrent.ExecutionException: com.microsoft.windowsazure.mobileservices.table.sync.push.MobileServicePushFailedException
W/System.err: at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
W/System.err: at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
W/System.err: at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
W/System.err: at com.heathrow.ecms.DatabaseAccess$3.doInBackground(DatabaseAccess.java:2178)
W/System.err: at com.heathrow.ecms.DatabaseAccess$3.doInBackground(DatabaseAccess.java:2173)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:292)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: com.microsoft.windowsazure.mobileservices.table.sync.push.MobileServicePushFailedException
W/System.err: at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.pushOperations(MobileServiceSyncContext.java:959)
W/System.err: at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.consumePushSR(MobileServiceSyncContext.java:859)
W/System.err: at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.access$1100(MobileServiceSyncContext.java:83)
W/System.err: at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext$PushSyncRequestConsumer.run(MobileServiceSyncContext.java:1120)
Code for sync is exactly the same as in the tutorial but with a different table, the error is on the push line.
private AsyncTask<Void, Void, Void> sync() {
AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>(){
@Override
protected Void doInBackground(Void... params) {
try {
MobileServiceSyncContext syncContext = mClient.getSyncContext();
syncContext.push().get();
mtblAttachment.pull(null).get();
} catch (final Exception e) {
e.printStackTrace();
}
return null;
}
};
return runAsyncTask(task);
}