本文整理汇总了Java中com.google.ipc.invalidation.external.client.android.service.ListenerService类的典型用法代码示例。如果您正苦于以下问题:Java ListenerService类的具体用法?Java ListenerService怎么用?Java ListenerService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListenerService类属于com.google.ipc.invalidation.external.client.android.service包,在下文中一共展示了ListenerService类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendEvent
import com.google.ipc.invalidation.external.client.android.service.ListenerService; //导入依赖的package包/类
@Override
public void sendEvent(final Bundle eventBundle) {
synchronized (LOCK) {
// Retrive info for that target client
String clientKey = eventBundle.getString(Parameter.CLIENT);
ClientState state = clientMap.get(clientKey);
Preconditions.checkNotNull(state, "No state for %s in %s", clientKey, clientMap.keySet());
// Bind to the listener associated with the client and send the event
ListenerBinder binder = new ListenerBinder(getBaseContext(), state.eventIntent,
InvalidationTestListener.class.getName());
binder.runWhenBound(new BoundWork<ListenerService>() {
@Override
public void run(ListenerService service) {
InvalidationTestService.this.sendEvent(service, new Event(eventBundle));
}
});
// Will happen after the runWhenBound invokes the receiver. Could also be done inside
// the receiver.
binder.release();
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:24,代码来源:InvalidationTestService.java
示例2: sendEvent
import com.google.ipc.invalidation.external.client.android.service.ListenerService; //导入依赖的package包/类
/**
* Send event messages to application clients and provides common processing of the response.
*/
private void sendEvent(final Event event) {
binder.runWhenBound(new BoundWork<ListenerService>() {
@Override
public void run(ListenerService listenerService) {
logger.fine("Sending %s event to %s", event.getAction(), clientKey);
service.sendEvent(listenerService, event);
}
});
}
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:AndroidClientProxy.java
示例3: sendEvent
import com.google.ipc.invalidation.external.client.android.service.ListenerService; //导入依赖的package包/类
/**
* Send event messages to application clients and provides common processing
* of the response.
*/
protected void sendEvent(ListenerService listenerService, Event event) {
try {
logger.fine("Sending %s event", event.getAction());
Bundle responseBundle = new Bundle();
listenerService.handleEvent(event.getBundle(), responseBundle);
// Wrap the response bundle and throw on any failure from the client
Response response = new Response(responseBundle);
response.warnOnFailure();
} catch (RemoteException exception) {
logger.severe("Unable to send event", exception);
throw new RuntimeException("Unable to send event", exception);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:AbstractInvalidationService.java
注:本文中的com.google.ipc.invalidation.external.client.android.service.ListenerService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论