本文整理汇总了Java中com.google.ipc.invalidation.external.client.android.service.Request类的典型用法代码示例。如果您正苦于以下问题:Java Request类的具体用法?Java Request怎么用?Java Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Request类属于com.google.ipc.invalidation.external.client.android.service包,在下文中一共展示了Request类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onStartCommand
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// Process GCM related messages from the ReceiverService. We do not check isCreated here because
// this is part of the stop/start lifecycle, not bind/unbind.
synchronized (lock) {
logger.fine("Received action = %s", intent.getAction());
if (MESSAGE_ACTION.equals(intent.getAction())) {
handleMessage(intent);
} else if (REGISTRATION_ACTION.equals(intent.getAction())) {
handleRegistration(intent);
} else if (ERROR_ACTION.equals(intent.getAction())) {
handleError(intent);
}
final int retval = super.onStartCommand(intent, flags, startId);
// Unless we are explicitly being asked to start, stop ourselves. Request.SERVICE_INTENT
// is the intent used by InvalidationBinder to bind the service, and
// AndroidInvalidationClientImpl uses the intent returned by InvalidationBinder.getIntent
// as the argument to its startService call.
if (!Request.SERVICE_INTENT.getAction().equals(intent.getAction())) {
stopServiceIfNoClientsRemain(intent.getAction());
}
return retval;
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:AndroidInvalidationService.java
示例2: initialize
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
/**
* Called to initialize a newly created client instance with the invalidation service.
*/
void initialize() {
// Create an intent that can be used to fire listener events back to the
// provided listener service. Use setComponent and not setPackage/setClass so the
// intent is guaranteed to be valid even if the service is not in the same application
Intent eventIntent = new Intent(Event.LISTENER_INTENT);
ComponentName component = new ComponentName(context.getPackageName(), listenerClass.getName());
eventIntent.setComponent(component);
Request request = Request
.newBuilder(Action.CREATE)
.setClientKey(clientKey)
.setClientType(clientType)
.setAccount(account)
.setAuthType(authType)
.setIntent(eventIntent)
.build();
executeServiceRequest(request);
addReference();
}
开发者ID:morristech,项目名称:android-chromium,代码行数:23,代码来源:AndroidInvalidationClientImpl.java
示例3: executeServiceRequest
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
/**
* Executes a request against the invalidation service and does common error processing against
* the resulting response. If unable to connect to the service or an error status is received from
* it, a warning will be logged and the request will be dropped.
*
* @param request the request to execute.
*/
private void executeServiceRequest(final Request request) {
serviceBinder.runWhenBound(new BoundWork<InvalidationService>() {
@Override
public void run(InvalidationService service) {
Bundle outBundle = new Bundle();
try {
service.handleRequest(request.getBundle(), outBundle);
} catch (RemoteException exception) {
logger.warning("Remote exeption executing request %s: %s", request,
exception.getMessage());
}
Response response = new Response(outBundle);
response.warnOnFailure();
}
});
}
开发者ID:morristech,项目名称:android-chromium,代码行数:24,代码来源:AndroidInvalidationClientImpl.java
示例4: create
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void create(Request request, Response.Builder response) {
synchronized (LOCK) {
validateRequest(request, Action.CREATE, Parameter.ACTION, Parameter.CLIENT,
Parameter.CLIENT_TYPE, Parameter.ACCOUNT, Parameter.AUTH_TYPE, Parameter.INTENT);
logger.info("Creating client %s:%s", request.getClientKey(), clientMap.keySet());
if (!TypedUtil.containsKey(clientMap, request.getClientKey())) {
// If no client exists with this key, create one.
clientMap.put(
request.getClientKey(), new ClientState(request.getAccount(), request.getAuthType(),
request.getIntent()));
} else {
// Otherwise, verify that the existing client has the same account / auth type / intent.
ClientState existingState = TypedUtil.mapGet(clientMap, request.getClientKey());
Preconditions.checkState(request.getAccount().equals(existingState.account));
Preconditions.checkState(request.getAuthType().equals(existingState.authType));
}
response.setStatus(Response.Status.SUCCESS);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:InvalidationTestService.java
示例5: resume
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void resume(Request request, Response.Builder response) {
synchronized (LOCK) {
validateRequest(
request, Action.RESUME, Parameter.ACTION, Parameter.CLIENT);
ClientState state = clientMap.get(request.getClientKey());
if (state != null) {
logger.info("Resuming client %s:%s", request.getClientKey(), clientMap.keySet());
response.setStatus(Response.Status.SUCCESS);
response.setAccount(state.account);
response.setAuthType(state.authType);
} else {
logger.warning("Cannot resume client %s:%s", request.getClientKey(), clientMap.keySet());
response.setStatus(Response.Status.INVALID_CLIENT);
}
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:InvalidationTestService.java
示例6: unregister
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void unregister(Request request, Response.Builder response) {
synchronized (LOCK) {
// Ensure that one (and only one) of the variant object id forms is used
String objectParam =
request.getBundle().containsKey(Parameter.OBJECT_ID) ?
Parameter.OBJECT_ID :
Parameter.OBJECT_ID_LIST;
validateRequest(request, Action.UNREGISTER, Parameter.ACTION,
Parameter.CLIENT, objectParam);
if (!validateClient(request)) {
response.setStatus(Response.Status.INVALID_CLIENT);
return;
}
response.setStatus(Response.Status.SUCCESS);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:InvalidationTestService.java
示例7: create
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void create(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
int clientType = request.getClientType();
Account account = request.getAccount();
String authType = request.getAuthType();
Intent eventIntent = request.getIntent();
clientManager.create(clientKey, clientType, account, authType, eventIntent);
response.setStatus(Status.SUCCESS);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:AndroidInvalidationService.java
示例8: resume
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void resume(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AndroidClientProxy client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
response.setAccount(client.getAccount());
response.setAuthType(client.getAuthType());
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationService.java
示例9: start
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void start(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AndroidInvalidationClient client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
client.start();
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:AndroidInvalidationService.java
示例10: stop
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void stop(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AndroidInvalidationClient client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
client.stop();
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:AndroidInvalidationService.java
示例11: register
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void register(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AndroidInvalidationClient client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
ObjectId objectId = request.getObjectId();
client.register(objectId);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationService.java
示例12: unregister
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void unregister(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AndroidInvalidationClient client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
ObjectId objectId = request.getObjectId();
client.unregister(objectId);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationService.java
示例13: acknowledge
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void acknowledge(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AckHandle ackHandle = request.getAckHandle();
AndroidInvalidationClient client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
client.acknowledge(ackHandle);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationService.java
示例14: destroy
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
protected void destroy(Request request, Response.Builder response) {
String clientKey = request.getClientKey();
AndroidInvalidationClient client = clientManager.get(clientKey);
if (setResponseStatus(client, request, response)) {
client.destroy();
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:AndroidInvalidationService.java
示例15: setResponseStatus
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
/**
* If {@code client} is {@code null}, sets the {@code response} status to an error. Otherwise,
* sets the status to {@code success}.
* @return whether {@code client} was non-{@code null}. *
*/
private boolean setResponseStatus(AndroidInvalidationClient client, Request request,
Response.Builder response) {
if (client == null) {
response.setError("Client does not exist: " + request);
response.setStatus(Status.INVALID_CLIENT);
return false;
} else {
response.setStatus(Status.SUCCESS);
return true;
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:AndroidInvalidationService.java
示例16: register
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
/**
* Registers to receive invalidation notifications for an object.
*
* @param objectId object id.
*/
@Override
public void register(ObjectId objectId) {
Request request =
Request.newBuilder(Action.REGISTER).setClientKey(clientKey).setObjectId(objectId).build();
executeServiceRequest(request);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidInvalidationClientImpl.java
示例17: unregister
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
/**
* Unregisters to disable receipt of invalidations on an object.
*
* @param objectId object id.
*/
@Override
public void unregister(ObjectId objectId) {
Request request =
Request.newBuilder(Action.UNREGISTER).setClientKey(clientKey).setObjectId(objectId).build();
executeServiceRequest(request);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidInvalidationClientImpl.java
示例18: acknowledge
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
public void acknowledge(AckHandle ackHandle) {
Request request = Request
.newBuilder(Action.ACKNOWLEDGE)
.setClientKey(clientKey)
.setAckHandle(ackHandle)
.build();
executeServiceRequest(request);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationClientImpl.java
示例19: destroy
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
@Override
public void destroy() {
Request request = Request
.newBuilder(Action.DESTROY)
.setClientKey(clientKey)
.build();
executeServiceRequest(request);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:AndroidInvalidationClientImpl.java
示例20: initResumed
import com.google.ipc.invalidation.external.client.android.service.Request; //导入依赖的package包/类
/**
* Called to resume an existing client instance with the invalidation service. Iff
* {@code sendTiclResumeRequest}, a request is sent to the invalidatation service to ensure
* that the Ticl is loaded.
*/
void initResumed(boolean sendTiclResumeRequest) {
if (sendTiclResumeRequest) {
Request request = Request.newBuilder(Action.RESUME).setClientKey(clientKey).build();
executeServiceRequest(request);
}
addReference();
}
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:AndroidInvalidationClientImpl.java
注:本文中的com.google.ipc.invalidation.external.client.android.service.Request类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论