From the File menu select New > Project....

New Project menu

The New Project wizard is displayed. Select iDigi Android Project within the Android folder and click Next to start the wizard.

Wizard selection window

Enter a name for your project into the Project name field, for example UploadFile. Then, select the Android API Level (version) to use for the project.

iDigi Android application project wizard

Warning

The name of the project must be unique in the workspace. If there is already a project with the same name inside the workspace, the wizard displays a message and will not continue until a different name is used.

Optionally you can also change the Package name and Activity name for the project.

Click Finish to create the project.

When the project is created, it is displayed in the Package Explorer view. Expand it to see its contents.

Package Explorer

Teach

You have just learned how to create a new iDigi Android project.


Open the main activity file of the project to start editing it. The file is located under the src/<package name> folder of the project.

Package Explorer - Main activity file

Double-click the file to open it in the main editor.

Main activity file

Replace the following lines:

Host session

// TODO: write your application code here:
// ---------------------------------------
// Use iDigiServiceManager.sendTextFile("path/filename", "filedata") to
// upload a text file (*.txt, *.xml, etc) to iDigi with the given contents.
// ---------------------------------------
// Use iDigiServiceManager.sendFile("path/filename", "localpath") to
// upload any local file to iDigi.
// ---------------------------------------
// Use iDigiServiceManager.subscribeDoCommand("target", this) to
// listen for do_commands of the specified target.


With this one:

Host session

iDigiServiceManager.sendTextFile("myFile.txt", "iDigi is easy!");


This line of code is sending a text file to iDigi called myFile.txt containing the iDigi is easy! text. This is sent when the application is started.

The file should now appear as follows:

Main activity file - Modified

Save the file and build the project. To do so, select the project from the Package Explorer view, right click on it and select the Build Project option from the context menu.

Build the project

Tip

If you do not see the Build option in the context menu, go to the Project menu and disable the Build Automatically option. Then try again.

Build automatically



If you are working in Linux, you will need to kill the current process and then start it as root. If you already did it or you are working in Windows, you can continue with the launch process, otherwise follow these steps:

  1. Open a shell console and kill the current process by executing the following command:

    Host session

    /<android_sdk_location>/platform-tools/adb kill-server


    Where <android_sdk_location> is the path where the Android is installed.

  2. Restart the process by issuing this command:

    Host session

    sudo /<android_sdk_location>/platform-tools/adb start-server


    Where <android_sdk_location> is the path where the Android is installed.

  3. To verify that you are the owner of the instead of Eclipse, you should see the following output in the shell:

    Host session

    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *


    If you don't see that output, you should repeat steps 1 and 2.

The last step in this process is to launch the iDigi project. To do so, select the project from the Package Explorer view, right-click on it and select the Run As > Android Application option from the context menu.

Tip

In the future, you can launch your project by clicking the Run button from the main toolbar.

Run button


This action will launch the iDigi Android application in your Android device. Depending on your Android device type, the process will behave differently:

The launch process takes a while to complete; it will display its progress in the Console view:

Console progress

It is very important that the iDigi Connector for Android is running before you launch the application. You will know that iDigi is running if the iDigi logo is displayed in the status bar.

Once the application is launched, the Android device will display its main activity:

First application - Main activity

If iDigi was already running before you launched the application, you can continue with the next step, .

In this case, the service was not running as the logo is not displayed, so the file was not uploaded to iDigi. It is necessary to start the iDigi Connector for Android and execute the application again. To do so follow these steps:

  1. Go to the applications menu and execute the iDigi for Android application.

    Applications menu

  2. Activate the Connector for Android by pressing the Activate iDigi option.

    Start iDigi Connector for Android

  3. Return to the applications menu and execute your UploadFile application.

    Applications menu - First application

  4. Notice that the iDigi logo is visible, meaning that the iDigi Connector for Android is running.

    First application - iDigi running


Teach

You have just learned how to launch an iDigi Android application project.


Clock


Prev. Step

Home

Next Step