Digi provides sample projects that demonstrate how to use the API extensions to access hardware interfaces available in your device.

Ensure that the Digi plugin is installed. To learn how to install it, see the instructions for "Digi Extensions for Android Studio" in Step 4.1: Install the software.

To import a Digi sample application:

  1. Open the Import Digi Sample wizard by doing one of the following:

    • Select More Actions > Import a Digi Android code sample on the Welcome screen.

    • Select File > New > Import Digi Sample from the menu.

  2. On the Browse Samples page of the wizard, select one of the available Digi samples and click Next.

    Import Sample Wizard 1

  3. On the Configure Sample page of the wizard, configure the Application name and the Project location.

    Import Sample Wizard 2

  4. Click Finish to import the example. It opens in a new Android Studio window.

    Sample applications are configured to use a specific version of the Gradle plugin that has been validated. New versions of Android Studio may ask you to update sample applications to the latest Gradle plugin. Doing so will cause sample applications to stop building properly. Digi recommends you do not update sample applications to the latest Gradle plugin.

    Update gradle plugin

  5. Wait a few seconds while the compiler is working and click the Run button to launch the application on the device.

Android Studio does not automatically update examples to the latest version. Examples may need to be modified to work with newer versions of Android Studio than the one tested with this release.

By default, all sample applications are configured to run with the latest released version of the Digi SDK Add-on for Embedded. If you are using an Android version different than the latest released one, you might need to properly configure the sample application before running it in your platform. To do so, follow these steps:

  1. Edit the app/build.gradle file and set Digi International:Digi SDK Add-on for Embedded:30 as compileSdkVersion value: image

  2. Save the changes and let Android Studio sync the project again.