Android SDK wokring with Drupal Services
You need below for this project:
Android studio 0.3.+ Gradle 1.8
The project implement with gradle, so please gradle sync before compile the project. Since Android studio is actively changed, the build.gradle may got something not functioning.
The project is not yet ready for production !!
Installation guide: https://github.com/drucloud/drupalForAndroidSDK/wiki/Installation-guide
The project right now supports 2 legged oauth while real 3 legged case please reference: https://drupal.org/project/oauth3legged_client
It also supports session auth and flexable to add any auth plugin. Just use .setAuth method, see DemoActivity
We currently dont have plan to support single server 3 legged oauth as it is not that meaningful. Please let us know if you have this requirement.
The 2 legged oauth is very simple, please reference our drupalForAndroidSDKDemo in the project.
Example:
new Thread(){
public void run(){
try {
//Session Auth example
DrupalServicesNode DruNode = new DrupalServicesNode("http://dev-oapi.mobingi.com", "stub" );
DruNode.setAuth(new DrupalAuthSession("admin", "jingan2world"));
String responseNodeGet = DruNode.retrieve(1346);
System.out.println("New Session test response is :" + responseNodeGet);
} catch (Exception e) {
Log.e("HTTP GET:", e.toString());
}
}
}.start();
- Add more web services support based on default Drupal services 3.x
- Support services views
- Support some AWS SDK features
- API documentation
- Support single server oauth3legged
- Support other project like Eclipse
Call for help ~ :)
- Signpost library
- Apache http library
If you are getting Access denied, or API Key not valid, double check that your key settings are setup correctly at admin/build/services/keys and double check that permissions are correct for your user and anonymous.
Checkout the Issue queue, or create new issues
Creating a node
Example:
BasicNameValuePair[] data = new BasicNameValuePair[4];
data[0] = new BasicNameValuePair("type", "article");
data[1] = new BasicNameValuePair("title", "Test android create body 1");
String bodyValue = "testing123";
data[2] = new BasicNameValuePair("body[und][0][value]", bodyValue);
data[3] = new BasicNameValuePair("body[und][0][format]", "filtered_html");
// or according to https://gist.github.com/kylebrowning/affc9864487bb1b9c918
//data[0] = new BasicNameValuePair("node[type]", "article");
//data[1] = new BasicNameValuePair("node[title]", "Test android create 2");
String response = oauth.create(data);