예제 #1
0
파일: Survey.java 프로젝트: Marcos-G/punya
 @SimpleFunction(description = "This will clean up the survey database on the smartphone")
 public void DeleteSurveyDB() {
   Intent i = new Intent(mainUI, NameValueDatabaseService.class);
   Log.i(TAG, "archiving data...at: " + System.currentTimeMillis());
   i.setAction(DatabaseService.ACTION_ARCHIVE);
   i.putExtra(DatabaseService.DATABASE_NAME_KEY, SURVEY_DBNAME);
   mainUI.startService(i);
 }
예제 #2
0
파일: Survey.java 프로젝트: Marcos-G/punya
  /*
   * Exporting Survey DB to External Storage
   */
  @SimpleFunction(
      description =
          "Export Survey results database as CSV files or JSON files."
              + "Input \"csv\" or \"json\" for exporting format.")
  public void Export(String format) {
    if (format == NameValueDatabaseService.EXPORT_JSON)
      this.exportFormat = NameValueDatabaseService.EXPORT_JSON;
    else this.exportFormat = NameValueDatabaseService.EXPORT_CSV;
    // if the user input the wrong format, we will just use csv by default
    Log.i(TAG, "exporting data...at: " + System.currentTimeMillis());

    Bundle b = new Bundle();
    b.putString(NameValueDatabaseService.DATABASE_NAME_KEY, SURVEY_DBNAME);
    b.putString(NameValueDatabaseService.EXPORT_KEY, format);
    Intent i = new Intent(mainUI, NameValueDatabaseService.class);
    i.setAction(DatabaseService.ACTION_EXPORT);
    i.putExtras(b);
    mainUI.startService(i);
  }