How to use SOXLib in android

You can use Sox Library for Java in Android. Firstly, please download Android Studio and JSoxLib.
SOX Libraryr uses Smack library, so after creating new project, you have to setup project to use Smack.

(1) In: project -> build.gradle, please include following maven setting

repositories {
    
	maven {
		url 'https://oss.sonatype.org/content/repositories/snapshots'
	}
	mavenCentral()
	
	jcenter()
}
				
(2) In: project -> app -> build.gradle, please include following compile setting
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    ...
    
    compile 'org.igniterealtime.smack:smack-android-extensions:4.1.0'
    compile 'org.igniterealtime.smack:smack-tcp:4.1.0'
    compile('org.simpleframework:simple-xml:2.7.1'){
        exclude module: 'stax-api'
        exclude module: 'xpp3'
    }
    
}
				

Then, please copy JSoxLib.jar and joda-time-*.jar from downloaded&unzipped JSoxLib.zip into app/libs directory.


Note that if you directly copy the jar files to Android Studio, please right click on the jar file and select menu of 'add as library'.

That's it ! You can now use SOX API for your android application like this (very simple example)!
...
import jp.ac.keio.sfc.ht.sox.soxlib.SoxConnection;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);


        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        //this is test for SOX API
        new AsyncTask() {
            @Override
            protected String doInBackground(Void... voids) {
                try

                {
                    SoxConnection con = new SoxConnection("sox.ht.sfc.keio.ac.jp", false);

                    List nodeList = con.getAllSensorList();
                    for (String node : nodeList) {
                        System.out.println(node);
                    }

                } catch (
                        Exception e
                        )

                {
                    e.printStackTrace();
                }
                return "";
            }
        }.execute();
    }
...