Exemplo n.º 1
0
 private void updateTimeTable() {
   Uri timeUri = Uri.parse(CloudSyncContentProvider.TIME_CONTENT_URI.toString());
   ContentValues timeValue = new ContentValues();
   timeValue.put(TimeTable.TIMESTAMP, timeofThisSync);
   timeValue.put(TimeTable.PACKAGE_NAME, NotepadSync.PACKAGE_NAME);
   Uri insTime = context.getContentResolver().insert(timeUri, timeValue);
   if (debug) Log.d(TAG, "Inserted time uri is " + insTime.toString());
 }
Exemplo n.º 2
0
  private long getLastSyncTime() {

    Uri timeTableUri = Uri.parse(CloudSyncContentProvider.TIME_CONTENT_URI.toString());
    Cursor timeTableCursor =
        context
            .getContentResolver()
            .query(
                timeTableUri,
                null,
                TimeTable.PACKAGE_NAME + "=?",
                new String[] {NotepadSync.PACKAGE_NAME},
                TimeTable.TIMESTAMP);

    if (timeTableCursor.getCount() == 0) {
      return 0;
    }
    timeTableCursor.moveToLast(); //  check whether it returns the highest value checked
    long lastSyncTime = timeTableCursor.getLong(1);
    if (debug) Log.d(TAG, "the lastSync time is: " + lastSyncTime);
    timeTableCursor.close();
    return lastSyncTime;
  }