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 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 Sample Setup 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.

    Android Studio will likely recommend that you update the Android Gradle plugin when you import an example. Development on the Android Gradle plugin is ongoing, but Digi samples are configured with a specific Gradle version.

    Update gradle plugin

    Click Update and Android Studio performs the update.

  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. Right-click your Android project and select Open Module Settings. The Project Structure dialog appears.

  2. In the Compile Sdk Version box, select Digi SDK Add-on for Embedded (API 28).

    image

  3. Click OK to close the dialog and apply the changes.