iDigi Android application projects are very similar to other Android projects. These projects are composed of a source directory containing java class files (.java) and packages. They also include a new lib folder with the iDigi_library that will be used to connect to iDigi.

When the project is created, a default application activity is created with it. This activity will be the main entry point of your application, and is located within the src folder in the package specified in the wizard. In this case, src > com.sample.android > my_idigi_android_projectActivity.java:

Main file location

Double-click the my_idigi_android_projectActivity.java file to open it in the editor.

Main file editor

The onCreate() method is invoked when the activity is started and is where you should start writing your application code. The main difference between a standard Android Application Project and an iDigi Android Application Project is the implementation of the IDoCommandListener interface in the class declaration and the instance of the iDigiServiceManager that is created on application start-up.

The iDigiServiceManager object is responsible for communicating with the running iDigi Service instance of the device, and will be used to perform all the related iDigi actions.

For a complete list of methods and properties of the iDigi Service Manager read iDigi Android Library Reference chapter.

In order to upload a text file to iDigi, the sendTextFile() method of the iDigiServiceManager must be invoked. This method requires two arguments:

Here is an example of the usage of this method:

Host session

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


This code will upload a new text file to iDigi with myFile.txt as the file name, and iDigi is easy! as the file contents.

In order to upload a file to iDigi, the sendFile() method of the iDigiServiceManager must be invoked. This method required two arguments:

Here is an example of the usage of this method:

Host session

iDigiServiceManager.sendFile("myImage.jpg", "/mnt/sdcard/myImage.jpg");


This code will upload the local file /mnt/sdcard/myImage.jpg to iDigi and will name it myImage.jpg.

Subscribing to a do_command means to command the application to start listening for an incoming iDigi command with an specific target ID (command identifier).

In order to start listening for incoming do commands, the subscribeDoCommand() method of the iDigiServiceManager must be invoked. This method required two arguments:

Here is an example of the usage of this method:

Host session

iDigiServiceManager.subscribeDoCommand("myTarget", this);


This code will register a listener in the application waiting for incoming iDigi messages with myTarget as command identifier or target. Multiple do_command listeners can be registered in the same application.

Once a registered do_command target is received, the application will execute the commandReceived callback with the target or command identifier that was received, and the command data to work with as parameters. The commandReceived callback method is included by default in the application when the IDoCommandListener interface is implemented in the class constructor. Callback allows you to execute specific code depending on the command and data received. For example, you can write this code in the commandReceived callback in order to show a popup message with the received command and data every time a registered command is received:

Host session

Toast.makeText(this,"do_command received: " + data.trim(),Toast.LENGTH_LONG).show();
return "do_command received";


This is the result in the application:

do command received