tags:

views:

101

answers:

0

I am using android default codebase 2.0 to try to write an ActiveSync for calendar. I coded the function "sendLocalchanges" in Email App's CalendarSyncAdapter.java, like below:

@Override public boolean sendLocalChanges(Serializer s) throws IOException { // TODO Auto-generated method stub

s.start(Tags.SYNC_COMMANDS); String clientId = ""+System.currentTimeMillis(); s.start(Tags.SYNC_ADD); s.data(Tags.SYNC_CLIENT_ID, clientId);

 s.start(Tags.SYNC_APPLICATION_DATA);

 s.data(Tags.CALENDAR_START_TIME, "20100413T190000Z");
 s.data(Tags.CALENDAR_SUBJECT, "test");
 s.data(Tags.CALENDAR_END_TIME, "20100413T200000Z");
 s.data(Tags.CALENDAR_ALL_DAY_EVENT, "1");

s.end();  // Application
s.end();  // Add
s.end();  // COMMANDS
return false;

}

But when I send this add command to excheange server (mail.zing.com), I got a error response form server. The response status is equal to 6. In spec [MS-ASCMD].pdf 2.2.1.19.2.16 :
    meaning-Error in client/server conversion.
    cause-The client has sent a malformed or invalid item.
I can't find out what wrong with this code. Please help me to check the sync behavior for calendar ActiveSync. How shall I fix the code?
thanks a lot.