本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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;
}
}
示例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;
}
}