https://github.com/structr/structr-android-client
Android client which connects to the Structr REST server
https://github.com/structr/structr-android-client
Last synced: about 1 month ago
JSON representation
Android client which connects to the Structr REST server
- Host: GitHub
- URL: https://github.com/structr/structr-android-client
- Owner: structr
- Created: 2012-03-18T17:03:47.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2017-05-23T07:48:45.000Z (about 8 years ago)
- Last Synced: 2024-03-26T01:15:44.660Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 38.1 KB
- Stars: 5
- Watchers: 10
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
structr Android Client
======================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.
## Features
- 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.
## Step 1: Build structr-android-client
- Clone this repository
- mvn package
- mvn generate-sources javadoc:javadoc## Step 2: Integrate structr-android-client in your Android app
- 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## Step 3: Map your structr entities to POJOs
public class MyEntitiy extends StructrObject {
@Expose private String id;
@Expose private String name;
@Expose private Date timestamp;
@Expose private String location;
}## Step 4: Use one of the various connectors to access the REST server
new IdEntityLoader(new EntityHandler() {
public void handleProgress(Progress... progress) {
// handle progress / exception
}
public void handleResults(StructrObject result) {
// handle result
}
}).execute(MyEntity.class, id");## Tips
- 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.