Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
add registerDeviceForPushAsync method, sync lib with latest usergrid-…
Browse files Browse the repository at this point in the history
…java-sdk
  • Loading branch information
theganyo committed Apr 26, 2013
1 parent e466242 commit 0ea5f14
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
Binary file removed dist/usergrid-android-client-0.0.1-SNAPSHOT.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion pom.xml
Expand Up @@ -39,6 +39,10 @@
<id>tnine</id>
<name>Todd Nine</name>
</developer>
<developer>
<id>sganyo</id>
<name>Scott Ganyo</name>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:apigee/usergrid-android-sdk.git</connection>
Expand All @@ -50,7 +54,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>usergrid-java-client</artifactId>
<version>0.0.1</version>
<version>0.0.5</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
Expand Down
50 changes: 28 additions & 22 deletions src/main/java/org/usergrid/android/client/Client.java
@@ -1,26 +1,9 @@
package org.usergrid.android.client;

import static org.springframework.util.StringUtils.arrayToDelimitedString;
import static org.springframework.util.StringUtils.tokenizeToStringArray;
import static org.usergrid.android.client.utils.ObjectUtils.isEmpty;



import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

import org.codehaus.jackson.node.JsonNodeFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.usergrid.android.client.callbacks.ApiResponseCallback;
import org.usergrid.android.client.callbacks.ClientAsyncTask;
Expand All @@ -36,7 +19,6 @@

import android.content.Context;
import android.location.Location;
import android.util.Log;

/**
* The Client class for accessing the Usergrid API. Start by instantiating this
Expand Down Expand Up @@ -77,8 +59,8 @@ public Client() {
* @param applicationId
* the application id or name
*/
public Client(String applicationId) {
super(applicationId);
public Client(String organizationId, String applicationId) {
super(organizationId, applicationId);
}


Expand Down Expand Up @@ -186,9 +168,33 @@ public Device doTask() {
}).execute();
}



/**
/**
* Registers a device using the device's unique device ID. Executes
* asynchronously in background and the callbacks are called in the UI
* thread.
*
* @param context
* @param properties
* @param callback
*/
public void registerDeviceForPushAsync(final Context context,
final String notifier,
final String token,
final Map<String, Object> properties,
final DeviceRegistrationCallback callback) {
(new ClientAsyncTask<Device>(callback) {
@Override
public Device doTask() {
UUID deviceId = new DeviceUuidFactory(context).getDeviceUuid();

return registerDeviceForPush(deviceId, notifier, token, properties);
}
}).execute();
}


/**
* Create a new entity on the server. Executes asynchronously in background
* and the callbacks are called in the UI thread.
*
Expand Down

0 comments on commit 0ea5f14

Please sign in to comment.