The classes in this repository enable your Android App to connect to a REST web service built with structr. You can use structr-core and structr-rest to build a domain-specific REST API. structr is backed by the Neo4j graph database.
- Asynchronous connectors to keep the user interface responsive while loading data in the background
- SSL support
- Fully automatic serialization and deserialization with GSON
- Use POJOs in your android code
- Use @Expose annotation to map POJO fields to structr REST output
- ...
Please note that this software is early alpha status. Use carefully at your own risk.
- Clone this repository
- mvn package
- mvn generate-sources javadoc:javadoc
- Copy target/structr-android-client-0.1-SNAPSHOT from step 1 into the libs/ directory of your android app
- Call StructrConnector.initialize() in the onCreate() method of your main activity
public class MyEntitiy extends StructrObject {
@Expose private String id;
@Expose private String name;
@Expose private Date timestamp;
@Expose private String location;
}
new IdEntityLoader(new EntityHandler() {
public void handleProgress(Progress... progress) {
// handle progress / exception
}
public void handleResults(StructrObject result) {
// handle result
}
}).execute(MyEntity.class, id");
- Use a common base class for all your entities that contains the ID property; that way you don't have to expose the ID field in each of your entities.