|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.stackmob.sdk.push.StackMobPush
public class StackMobPush
| Field Summary | |
|---|---|
static String |
DEFAULT_PUSH_HOST
|
| Constructor Summary | |
|---|---|
StackMobPush(int apiVersionNumber,
String apiKey,
String apiSecret)
a minimal constructor, using defaults for everything else |
|
StackMobPush(int apiVersionNumber,
String apiKey,
String apiSecret,
String host,
StackMobRedirectedCallback redirectedCallback)
the most complete constructor |
|
StackMobPush(StackMob stackmob)
create a StackMobPush based on a StackMob object and defaults elsewhere. |
|
StackMobPush(StackMob stackmob,
String host)
create a StackMobPush based on a StackMob object and the given host |
|
| Method Summary | |
|---|---|
void |
broadcastPushNotification(Map<String,String> payload,
StackMobRawCallback callback)
broadcast a push notification to all users of this app. |
static StackMobPush |
getPush()
get the singleton StackMobPush object |
void |
getTokensForUsers(List<String> usernames,
StackMobRawCallback callback)
get all the tokens for the each of the given users |
void |
pushToTokens(Map<String,String> payload,
List<StackMobPushToken> tokens,
StackMobRawCallback callback)
send a push notification to a group of tokens |
void |
pushToUsers(Map<String,String> payload,
List<String> userIds,
StackMobRawCallback callback)
send a push notification to a group of users. |
void |
registerForPushWithUser(StackMobPushToken token,
String username,
boolean overwrite,
StackMobRawCallback callback)
register a user for Android Push notifications. |
void |
registerForPushWithUser(StackMobPushToken token,
String username,
StackMobRawCallback callback)
register a user for Android Push notifications. |
void |
removePushToken(StackMobPushToken token,
StackMobRawCallback callback)
remove a push token for this app |
static void |
setPush(StackMobPush push)
set the singletone StackMobPush |
static void |
setPushType(StackMobPushToken.TokenType type)
Sets the type of push this StackMob instance will do. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String DEFAULT_PUSH_HOST
| Constructor Detail |
|---|
public StackMobPush(int apiVersionNumber,
String apiKey,
String apiSecret)
apiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandboxapiKey - the api key for your appapiSecret - the api secret for your app. Can be null if you're using OAuth2
public StackMobPush(int apiVersionNumber,
String apiKey,
String apiSecret,
String host,
StackMobRedirectedCallback redirectedCallback)
apiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandboxapiKey - the api key for your appapiSecret - the api secret for your app. Can be null if you're using OAuth2host - the base url for requestsredirectedCallback - callback to be called if the StackMob platform issues a redirect. you should use this callback to cache the new URLs. here is a sample callback:
new StackMobRedirectedCallback() {
public void redirected(HttpRequest origRequest, HttpResponse response, HttpRequest newRequest) {
try {
URI uri = new URI(newRequest.getRequestLine().getUri());
cache(uri.getHost);
}
catch (URISyntaxException e) {
handleException(e);
}
}
}
}
note that this callback may be called in a background threadpublic StackMobPush(StackMob stackmob)
StackMob object and defaults elsewhere.
stackmob - the StackMob object to get values from
public StackMobPush(StackMob stackmob,
String host)
StackMob object and the given host
stackmob - the StackMob object to get values fromhost - the base url for requests| Method Detail |
|---|
public static void setPushType(StackMobPushToken.TokenType type)
type - C2DM or GCMpublic static StackMobPush getPush()
public static void setPush(StackMobPush push)
push - the new singleton
public void pushToTokens(Map<String,String> payload,
List<StackMobPushToken> tokens,
StackMobRawCallback callback)
payload - the payload of the push notification to sendtokens - the tokens to which to sendcallback - callback to be called when the server returns. may execute in a separate thread
public void pushToUsers(Map<String,String> payload,
List<String> userIds,
StackMobRawCallback callback)
payload - the payload to senduserIds - the IDs of the users to which to sendcallback - callback to be called when the server returns. may execute in a separate thread
public void registerForPushWithUser(StackMobPushToken token,
String username,
StackMobRawCallback callback)
token - a token containing a registration id and platformusername - the StackMob username to associate with this tokencallback - callback to be called when the server returns. may execute in a separate thread
public void registerForPushWithUser(StackMobPushToken token,
String username,
boolean overwrite,
StackMobRawCallback callback)
token - a token containing a registration id and platformusername - the StackMob username to associate with this tokenoverwrite - whether to overwrite existing entriescallback - callback to be called when the server returns. may execute in a separate thread
public void getTokensForUsers(List<String> usernames,
StackMobRawCallback callback)
usernames - the users whose tokens to getcallback - callback to be called when the server returns. may execute in a separate thread
public void broadcastPushNotification(Map<String,String> payload,
StackMobRawCallback callback)
payload - the payload to broadcastcallback - callback to be called when the server returns. may execute in a separate thread
public void removePushToken(StackMobPushToken token,
StackMobRawCallback callback)
token - the tokencallback - callback to be called when the server returns. may execute in a separate thread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||