Search in sources :

Example 6 with Collect

use of org.odk.collect.android.application.Collect in project collect by opendatakit.

the class InstanceServerUploader method getServerSubmissionURL.

private String getServerSubmissionURL() {
    Collect app = Collect.getInstance();
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(Collect.getInstance());
    String serverBase = settings.getString(PreferenceKeys.KEY_SERVER_URL, app.getString(R.string.default_server_url));
    if (serverBase.endsWith(URL_PATH_SEP)) {
        serverBase = serverBase.substring(0, serverBase.length() - 1);
    }
    // NOTE: /submission must not be translated! It is the well-known path on the server.
    String submissionPath = settings.getString(PreferenceKeys.KEY_SUBMISSION_URL, app.getString(R.string.default_odk_submission));
    if (!submissionPath.startsWith(URL_PATH_SEP)) {
        submissionPath = URL_PATH_SEP + submissionPath;
    }
    return serverBase + submissionPath;
}
Also used : Collect(org.odk.collect.android.application.Collect) SharedPreferences(android.content.SharedPreferences)

Aggregations

Collect (org.odk.collect.android.application.Collect)6 FormController (org.odk.collect.android.logic.FormController)4 Activity (android.app.Activity)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Nullable (android.support.annotation.Nullable)1 FormIndex (org.javarosa.core.model.FormIndex)1