当前位置: 首页>>代码示例>>Java>>正文


Java AndroidTiclManifest类代码示例

本文整理汇总了Java中com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest的典型用法代码示例。如果您正苦于以下问题:Java AndroidTiclManifest类的具体用法?Java AndroidTiclManifest怎么用?Java AndroidTiclManifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AndroidTiclManifest类属于com.google.ipc.invalidation.ticl.android2包,在下文中一共展示了AndroidTiclManifest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendMessage

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
@Override
public void sendMessage(byte[] outgoingMessage) {
  Intent intent = ProtocolIntents.newOutboundMessageIntent(outgoingMessage);

  // Select the sender service to use for upstream message.
  if (AndroidChannelPreferences.getGcmChannelType(context) == GcmChannelType.GCM_UPSTREAM){
    String upstreamServiceClass = new AndroidTiclManifest(context).getGcmUpstreamServiceClass();
    if (upstreamServiceClass == null || upstreamServiceClass.isEmpty()) {
      logger.warning("GcmUpstreamSenderService class not found.");
      return;
    }
    intent.setClassName(context, upstreamServiceClass);
  } else {
    intent.setClassName(context, AndroidMessageSenderService.class.getName());
  }
  try {
    context.startService(intent);
  } catch (IllegalStateException exception) {
    logger.warning("Unable to send message: %s", exception);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:22,代码来源:AndroidNetworkChannel.java

示例2: onRegistered

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
@Override
protected void onRegistered(String registrationId) {
  // Inform the sender service that the registration id has changed. If the sender service
  // had buffered a message because no registration id was previously available, this intent
  // will cause it to send that message.
  Intent sendBuffered = new Intent();
  final String ignoredData = "";
  sendBuffered.putExtra(AndroidChannelConstants.MESSAGE_SENDER_SVC_GCM_REGID_CHANGE, ignoredData);
  sendBuffered.setClass(this, AndroidMessageSenderService.class);
  startService(sendBuffered);

  // Inform the Ticl service that the registration id has changed. This will cause it to send
  // a message to the data center and update the GCM registration id stored at the data center.
  Intent updateServer = ProtocolIntents.InternalDowncalls.newNetworkAddrChangeIntent();
  updateServer.setClassName(this, new AndroidTiclManifest(this).getTiclServiceClass());
  startService(updateServer);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:AndroidMessageReceiverService.java

示例3: issueTiclIntent

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
/**
 * Issues the given {@code intent} to the TICL service class registered in the {@code context}.
 */
static void issueTiclIntent(Context context, Intent intent) {
  try {
    context.startService(intent.setClassName(context,
        new AndroidTiclManifest(context).getTiclServiceClass()));
  } catch (IllegalStateException exception) {
    logger.info("Unable to deliver ticl intent: %s", exception);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:12,代码来源:AndroidListenerIntents.java

示例4: onMessage

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
@Override
protected void onMessage(Intent intent) {
  // Forward the message to the Ticl service.
  if (intent.hasExtra(C2dmConstants.CONTENT_PARAM)) {
    String content = intent.getStringExtra(C2dmConstants.CONTENT_PARAM);
    byte[] msgBytes = Base64.decode(content, Base64.URL_SAFE);
    try {
      // Look up the name of the Ticl service class from the manifest.
      String serviceClass = new AndroidTiclManifest(this).getTiclServiceClass();
      AddressedAndroidMessage addrMessage = AddressedAndroidMessage.parseFrom(msgBytes);
      Intent msgIntent =
          ProtocolIntents.InternalDowncalls.newServerMessageIntent(addrMessage.getMessage());
      msgIntent.setClassName(this, serviceClass);
      startService(msgIntent);
    } catch (InvalidProtocolBufferException exception) {
      logger.warning("Failed parsing inbound message: %s", exception);
    }
  } else {
    logger.fine("GCM Intent has no message content: %s", intent);
  }

  // Store the echo token.
  String echoToken = intent.getStringExtra(C2dmConstants.ECHO_PARAM);
  if (echoToken != null) {
    AndroidChannelPreferences.setEchoToken(this, echoToken);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:28,代码来源:AndroidMessageReceiverService.java

示例5: requestAuthTokenForMessage

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
/**
 * Requests an auth token from the application to use to send {@code message} to the data
 * center.
 * <p>
 * If not {@code null}, {@code invalidAuthToken} is an auth token that was previously
 * found to be invalid. The intent sent to the application to request the new token will include
 * the invalid token so that the application can invalidate it in the {@code AccountManager}.
 */
private void requestAuthTokenForMessage(byte[] message, String invalidAuthToken) {
  /*
   * Send an intent requesting an auth token. This intent will contain a pending intent
   * that the recipient can use to send back the token (by attaching the token as a string
   * extra). That pending intent will also contain the message that we were just asked to send,
   * so that it will be echoed back to us with the token. This avoids our having to persist
   * the message while waiting for the token.
   */

  // This is the intent that the application will send back to us (the pending intent allows
  // it to send the intent). It contains the stored message. We require that it be delivered to
  // this class only, as a security check.
  Intent tokenResponseIntent = new Intent(this, getClass());
  tokenResponseIntent.putExtra(AuthTokenConstants.EXTRA_STORED_MESSAGE, message);

  // If we have an invalid auth token, set a bit in the intent that the application will send
  // back to us. This will let us know that it is a retry; if sending subsequently fails again,
  // we will not do any further retries.
  tokenResponseIntent.putExtra(AuthTokenConstants.EXTRA_IS_RETRY, invalidAuthToken != null);

  // The pending intent allows the application to send us the tokenResponseIntent.
  PendingIntent pendingIntent = PendingIntent.getService(
      this, Arrays.hashCode(message), tokenResponseIntent, PendingIntent.FLAG_ONE_SHOT);

  // We send the pending intent as an extra in a normal intent to the application. The
  // invalidation listener service must handle AUTH_TOKEN_REQUEST intents.
  Intent requestTokenIntent = new Intent(AuthTokenConstants.ACTION_REQUEST_AUTH_TOKEN);
  requestTokenIntent.putExtra(AuthTokenConstants.EXTRA_PENDING_INTENT, pendingIntent);
  if (invalidAuthToken != null) {
    requestTokenIntent.putExtra(AuthTokenConstants.EXTRA_INVALIDATE_AUTH_TOKEN, invalidAuthToken);
  }
  String simpleListenerClass =
      new AndroidTiclManifest(getApplicationContext()).getListenerServiceClass();
  requestTokenIntent.setClassName(getApplicationContext(), simpleListenerClass);
  try {
    startService(requestTokenIntent);
  } catch (SecurityException | IllegalStateException exception) {
    logger.warning("unable to request auth token: %s", exception);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:49,代码来源:AndroidMessageSenderService.java

示例6: setAndroidListenerClass

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
/** Sets the appropriate class for {@link AndroidListener} service intents. */
static Intent setAndroidListenerClass(Context context, Intent intent) {
  String simpleListenerClass = new AndroidTiclManifest(context).getListenerServiceClass();
  return intent.setClassName(context, simpleListenerClass);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:6,代码来源:AndroidListenerIntents.java

示例7: issueTiclIntent

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
/**
 * Issues the given {@code intent} to the TICL service class registered in the {@code context}.
 */
static void issueTiclIntent(Context context, Intent intent) {
  context.startService(intent.setClassName(context,
      new AndroidTiclManifest(context).getTiclServiceClass()));
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:AndroidListenerIntents.java

示例8: createClient

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
/**
 * Creates a new client.
 * <p>
 * REQUIRES: no client exist, or a client exists with the same type and name as provided. In
 * the latter case, this call is a no-op.
 *
 * @param context Android system context
 * @param clientType type of the client to create
 * @param clientName name of the client to create
 */
public static void createClient(Context context, int clientType, byte[] clientName) {
  ClientConfigP config = InvalidationClientCore.createConfig();
  Intent intent = ProtocolIntents.InternalDowncalls.newCreateClientIntent(
      clientType, Bytes.fromByteArray(clientName), config, false);
  intent.setClassName(context, new AndroidTiclManifest(context).getTiclServiceClass());
  context.startService(intent);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:AndroidClientFactory.java

示例9: createClient

import com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest; //导入依赖的package包/类
/**
 * Creates a new client.
 * <p>
 * REQUIRES: no client exist, or a client exists with the same type and name as provided. In
 * the latter case, this call is a no-op.
 *
 * @param context Android system context
 * @param clientType type of the client to create
 * @param clientName name of the client to create
 */
public static void createClient(Context context, ClientType.Type clientType, byte[] clientName) {
  ClientConfigP config = InvalidationClientCore.createConfig().build();
  Intent intent = ProtocolIntents.InternalDowncalls.newCreateClientIntent(
      clientType.getNumber(), clientName, config, false);
  intent.setClassName(context, new AndroidTiclManifest(context).getTiclServiceClass());
  context.startService(intent);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:AndroidClientFactory.java


注:本文中的com.google.ipc.invalidation.ticl.android2.AndroidTiclManifest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。