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


Java Cast.CastApi方法代码示例

本文整理汇总了Java中com.google.android.gms.cast.Cast.CastApi方法的典型用法代码示例。如果您正苦于以下问题:Java Cast.CastApi方法的具体用法?Java Cast.CastApi怎么用?Java Cast.CastApi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.cast.Cast的用法示例。


在下文中一共展示了Cast.CastApi方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeDataChannel

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Remove the custom data channel, if any. It returns <code>true</code> if it succeeds
 * otherwise if it encounters an error or if no connection exists or if no custom data channel
 * exists, then it returns <code>false</code>
 *
 * @return
 */
public boolean removeDataChannel() {
    if (TextUtils.isEmpty(mDataNamespace)) {
        return false;
    }
    try {
        if (null != Cast.CastApi && null != mApiClient) {
            Cast.CastApi.removeMessageReceivedCallbacks(mApiClient, mDataNamespace);
        }
        mDataChannel = null;
        Utils.saveStringToPreference(mContext, PREFS_KEY_CAST_CUSTOM_DATA_NAMESPACE, null);
        return true;
    } catch (Exception e) {
        LOGE(TAG, "Failed to remove namespace: " + mDataNamespace, e);
    }
    return false;

}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:25,代码来源:VideoCastManager.java

示例2: attachDataChannels

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * *********** Cast.Listener callbacks *********************************
 */

/*
 * Adds namespaces for data channel(s)
 * @throws NoConnectionException If no connectivity to the device exists
 * @throws TransientNetworkDisconnectionException If framework is still trying to recover from a
 * possibly transient loss of network
 * @throws IOException If an I/O error occurs while performing the request.
 * @throws IllegalStateException Thrown when the controller is not connected to a CastDevice.
 * @throws IllegalArgumentException If namespace is null.
 */
private void attachDataChannels() throws IllegalStateException, IOException, TransientNetworkDisconnectionException, NoConnectionException {
  checkConnectivity();
  if (!mNamespaceList.isEmpty() && null != Cast.CastApi) {
    for (String namespace : mNamespaceList) {
      Cast.CastApi.setMessageReceivedCallbacks(mApiClient, namespace, this);
    }
  }
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:22,代码来源:DataCastManager.java

示例3: removeDataChannel

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Remove the custom data channel, if any. It returns <code>true</code> if it succeeds otherwise
 * if it encounters an error or if no connection exists or if no custom data channel exists,
 * then it returns <code>false</code>
 */
public boolean removeDataChannel() {
  if (TextUtils.isEmpty(mDataNamespace)) {
    return false;
  }
  try {
    if (null != Cast.CastApi && null != mApiClient) {
      Cast.CastApi.removeMessageReceivedCallbacks(mApiClient, mDataNamespace);
    }
    return true;
  } catch (Exception e) {
    CastUtils.LOGE(TAG, "Failed to remove namespace: " + mDataNamespace, e);
  }
  return false;

}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:21,代码来源:VideoCastManager.java

示例4: attachDataChannels

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void attachDataChannels() throws IllegalStateException, IOException,
        TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    if (!mNamespaceList.isEmpty() && null != Cast.CastApi) {
        for (String namespace : mNamespaceList) {
            Cast.CastApi.setMessageReceivedCallbacks(mApiClient, namespace, this);
        }
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:10,代码来源:DataCastManager.java

示例5: detachDataChannels

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void detachDataChannels() {
    if (!mNamespaceList.isEmpty() && null != Cast.CastApi && null != mApiClient) {
        for (String namespace : mNamespaceList) {
            try {
                Cast.CastApi.removeMessageReceivedCallbacks(mApiClient, namespace);
            } catch (Exception e) {
                LOGE(TAG, "Failed to add namespace: " + namespace, e);
            }
        }
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:12,代码来源:DataCastManager.java

示例6: detachMediaChannel

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void detachMediaChannel() {
    LOGD(TAG, "trying to detach media channel");
    if (null != mRemoteMediaPlayer) {
        if (null != mRemoteMediaPlayer && null != Cast.CastApi) {
            try {
                Cast.CastApi.removeMessageReceivedCallbacks(mApiClient,
                        mRemoteMediaPlayer.getNamespace());
            } catch (Exception e) {
                LOGE(TAG, "Failed to detach media channel", e);
            }
        }
        mRemoteMediaPlayer = null;
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:15,代码来源:VideoCastManager.java

示例7: detachMediaChannel

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void detachMediaChannel() {
  CastUtils.LOGD(TAG, "trying to detach media channel");
  if (null != mRemoteMediaPlayer) {
    if (null != mRemoteMediaPlayer && null != Cast.CastApi) {
      try {
        Cast.CastApi.removeMessageReceivedCallbacks(mApiClient, mRemoteMediaPlayer.getNamespace());
      } catch (IOException e) {
        CastUtils.LOGE(TAG, "Failed to detach media channel", e);
      }
    }
    mRemoteMediaPlayer = null;
  }
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:14,代码来源:VideoCastManager.java


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