Skip to content

Manually Instantiation

javier7ar edited this page Apr 24, 2018 · 5 revisions

Manually Instantiation

  1. Create a Main Activity
    • You can create a class inherited from SamplersMainActivity. You will need to:

      1. Implement the getWorkflow() method and return the Workflow to pass to the TakeSampleActivity
      2. On the onCreate() method and set the NetworkConfiguration:
        NetworkConfiguration.setURL("http://192.168.1.10/samplers/upload.php");
        NetworkConfiguration.setPARAM_NAME_SAMPLE("sample");
        // Optional if you will use authentication
        NetworkConfiguration.setPARAM_NAME_USER_ID("user_id");
        NetworkConfiguration.setPARAM_NAME_AUTHENTICATION_TYPE("authentication_type");
        
        // Optional if you will use authentication, set the configuration
        AuthenticationManager.setAuthenticationEnabled(true);
        AuthenticationManager.setAuthenticationOptional(true);
    • You can create your own Main Activity and start the TakeSampleActivity like this:

      Workflow workflow = new Workflow();
      // ... populate the workflow as desired
      
      Intent intent = new Intent(this, TakeSampleActivity.class);        
      intent.putExtra(TakeSampleActivity.EXTRA_WORKFLOW, workflow);
      startActivity(intent);
    You will need to set the NetworkConfiguration and set the authentication configuration (optional) like the above example too.

Clone this wiki locally