Adding Context to an App

This topic explains in detail the process of adding context to your app.

For the Appdome Python library example refer to the snippet at the bottom.

The context step is optional; you may skip it and proceed to sign.

After Building your app, you can add context with the pre-configured settings of your selected Fusion Set in the previous step.

Caveats

  • Remember to visit the platform to obtain your API key, team_id if you are working with a team. See Getting started section.
  • This action can be invoked only after you acquired a task_id from a build process, and also only when the build process is successfully finished.

This process consists of the following steps, which should be performed in the order specified below:

  • POST request to Appdome to send the task_id obtained during the build process, action parameter with a value of context, and optionally overrides JSON object detailed at the Add context to app API reference page.
  • GET request to check the task status should be polled operation and wait until the status is success before proceeding to the next action.

The process

The scripts use several variables such as API_KEY, CONTEXT_OVERRIDES, TEAM_ID and task_id. Ensure that you update these parameters accordingly.

  1. Post the task_id to which you want to add context, with optional overrides.

    CONTEXT_OVERRIDES='{"icon_overlay":"...","icon_overlay_scale":"..."}'
    
    curl -s --request POST \
        --url "https://fusion.appdome.com/api/v1/tasks" \
        --header "Authorization: $API_KEY" \
        --header 'accept: application/json' \
        --header 'content-type: multipart/form-data' \
        --form action=context \
        --form parent_task_id=$task_id \
        --form overrides="$CONTEXT_OVERRIDES" >/dev/null
      statusWaiter "$task_id" "$TEAM_ID"
    
    
  2. Declare a function that will perform the polling operation and notify when the task status is completed. Note that the task may fail with a status of error and a message property that indicates the issue due to which the task failed and might help you resolve the issue before building again.

  3. statusWaiter() {
      task_id=$1
      team_id=$2
      status="progress"
      while [[ $status == "progress" ]]; do
        status=$(curl -s --request GET \
          --url "https://fusion.appdome.com/api/v1/tasks/$task_id/status?team_id=$team_id" \
          --header 'Content-Type: application/json' \
          --header "Authorization: $API_KEY" |
          jq -r '.status')
        sleep 0.5
      done
    }
    
    statusWaiter "$task_id" "$TEAM_ID"
    

At this point, if the status inside statusWaiter is completed, this means you have successfully added context to your app.

From here, you may proceed to sign an app.

Appdome python library example

python3 context.py --task_id <task_id_value> --new_bundle_id <bundle_id_value> --new_version <version_value> --new_build_number <build_number_value> --new_display_name <display_name_value> --app_icon <app_icon_file> --icon_overlay <icon_overlay_file>