summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/README.md b/README.md
index 85abb3a..84ddec1 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,31 @@ An incomplete list of implemented and planned features.
* Ability to share variables with other peers. (Implemented, 0.1)
* Network discovery with UDP broadcast. (Implemented, 0.1)
+## Example
+With Same you can share variables easily, like so:
+
+ // First: Some setup to get all your devices connected to the same network.
+ // Then, in your Activity:
+ ClientInterfaceBridge client = new ClientInterfaceBridge(this);
+ client.connect();
+ try {
+ // A VariableFactory is used to create distributed objects.
+ VariableFactory variableFactory = client.createVariableFactory();
+ Variable<String> myVariable = variableFactory.createString("MyVariable");
+
+ // Set the variable.
+ myVariable.set("Hello, Same!");
+
+ // Run update() to get the most recent version.
+ myVariable.update();
+
+ // Get the current value.
+ Log.i("The current value is: " + myVariable.get());
+ } finally {
+ // Always remember to disconnect.
+ client.disconnect();
+ }
+
## Release log
Pre-1.0: A release is a milestone in the project. Whenever the system seems to
be working fairly well, a commit is tagged as the release version.