A Java library to basic data storage abstraction
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Datastore is a Java library which makes life easier when working with datastore-server.

Adding it to classpath

If you are using maven, just download datastore and then run:

mvn install

Then just add maven dependency, if you are running it on desktop:

	<version>${datastore.version}</version> <!-- the version you want of datastore -->

Or add tne next dependency if you are running it on Android:

	<version>${datastore.version}</version> <!-- the version you want of datastore -->

If you don't use maven on your projects, just run:

mvn dependency:copy-dependencies

to download all dependencies of the project and add all of them to yours to make datastore to work correctly.

Instantiate scores main classes:

String gameKey = "..."; // your game key
String appUrl = "http://yourapplicationid.appspot.com"; // the url of the datastore-server instance
Scores scores = new ScoresHttpImpl(gameKey, appUrl);
Profiles profiles = new ProfilesHttpImpl(appUrl);

Submit a new score:

boolean guest = true;
Profile profile = profiles.register("new player", guest);
Score score = new Score(...);
scores.submit(profile.getPrivatekey(), score);

Request top 20 daily scores:

Set<String> tags = new HashSet<String>();
Collection<Score> dailyScores = scores.getOrderedByPoints(tags, 20, false, Range.Day);


That's all for now, explore the API by yourself and feel free to suggest enhancements or bugs on Issues page.