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


Java Cast.Listener方法代码示例

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


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

示例1: initCastClientListener

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void initCastClientListener() {
    mCastClientListener = new Cast.Listener() {
        @Override
        public void onApplicationStatusChanged() {
        }

        @Override
        public void onVolumeChanged() {
        }

        @Override
        public void onApplicationDisconnected( int statusCode ) {
            teardown();
        }
    };
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:17,代码来源:MainActivity.java

示例2: initCastClientListener

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void initCastClientListener() {
    mCastClientListener = new Cast.Listener() {
        @Override
        public void onApplicationStatusChanged() {
        }

        @Override
        public void onVolumeChanged() {
        }

        @Override
        public void onApplicationDisconnected(int statusCode) {
            teardown();
        }
    };
}
 
开发者ID:andrew749,项目名称:Muzik,代码行数:17,代码来源:PlayerActivity.java

示例3: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Start the receiver app
 */
private void launchReceiver() {
	try {
		mCastListener = new Cast.Listener() {

			@Override
			public void onApplicationDisconnected(int errorCode) {
				Log.d(TAG, "application has stopped");
				teardown();
			}

		};
		// Connect to Google Play services
		mConnectionCallbacks = new ConnectionCallbacks();
		mConnectionFailedListener = new ConnectionFailedListener();
		Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(mSelectedDevice, mCastListener);
		mApiClient = new GoogleApiClient.Builder(this).addApi(Cast.API, apiOptionsBuilder.build()).addConnectionCallbacks(mConnectionCallbacks)
				.addOnConnectionFailedListener(mConnectionFailedListener).build();

		mApiClient.connect();
	} catch (Exception e) {
		Log.e(TAG, "Failed launchReceiver", e);
	}
}
 
开发者ID:rubenjgarcia,项目名称:hello-chromecast,代码行数:27,代码来源:MainActivity.java

示例4: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Start the receiver app
 */
private void launchReceiver() {
	try {
		mCastListener = new Cast.Listener() {

			@Override
			public void onApplicationDisconnected(int errorCode) {
				teardown();
			}

		};
		// Connect to Google Play services
		mConnectionCallbacks = new ConnectionCallbacks();

		mConnectionFailedListener = new ConnectionFailedListener();
		Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(mSelectedDevice, mCastListener);
		mApiClient = new GoogleApiClient.Builder(this).addApi(Cast.API, apiOptionsBuilder.build())
				.addConnectionCallbacks(mConnectionCallbacks)
				.addOnConnectionFailedListener(mConnectionFailedListener).build();

		mApiClient.connect();
	} catch (Exception e) {
		Log.e(TAG, "Failed launchReceiver", e);
	}
}
 
开发者ID:eriklupander,项目名称:microgramcaster,代码行数:28,代码来源:MainActivity.java

示例5: createApiClient

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private GoogleApiClient createApiClient(Cast.Listener listener, Context context) {
    Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
            .builder(mSink.getDevice(), listener)
            // TODO(avayvod): hide this behind the flag or remove
            .setVerboseLoggingEnabled(true);

    return new GoogleApiClient.Builder(context)
            .addApi(Cast.API, apiOptionsBuilder.build())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:CreateRouteRequest.java

示例6: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void launchReceiver() {

        try {
            mCastListener = new Cast.Listener() {

                @Override
                public void onApplicationDisconnected(int errorCode) {
                    Log.d(TAG, "application has stopped");
                    //tearDownReceiver(true);
                }
            };

            // Connect to Google Play services
            mConnectionCallbacks = new PinCastConnectionCallbacks();
            mConnectionFailedListener = new PinCastConnectionFailedListener();
            Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
                    .builder(mSelectedDevice, mCastListener);
            mApiClient = new GoogleApiClient.Builder(this)
                    .addApi(Cast.API, apiOptionsBuilder.build())
                    .addConnectionCallbacks(mConnectionCallbacks)
                    .addOnConnectionFailedListener(mConnectionFailedListener)
                    .build();
            mApiClient.connect();

        } catch (Exception e) {
            Log.e(TAG, "Failed launchReceiver", e);
        }
    }
 
开发者ID:stantronic,项目名称:PinCast-Sender-Android,代码行数:29,代码来源:PinCastActivity.java

示例7: start

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Starts the process of launching the application on the Cast device.
 * @param androidMediaRouter Android's {@link MediaRouter} instance.
 * @param applicationContext application context
 * @param castApplicationListener {@link com.google.android.gms.cast.Cast.Listener}
 * implementation provided by the caller.
 */
public void start(
        MediaRouter androidMediaRouter,
        Context applicationContext,
        Cast.Listener castApplicationListener) {
    assert androidMediaRouter != null;
    assert applicationContext != null;
    assert castApplicationListener != null;

    if (mState != STATE_IDLE) throwInvalidState();

    if (mMediaSource == null) {
        reportError(String.format(ERROR_NEW_ROUTE_INVALID_SOURCE_URN, mSourceUrn));
        return;
    }

    mRoute = null;
    for (MediaRouter.RouteInfo route : androidMediaRouter.getRoutes()) {
        MediaSink routeSink = MediaSink.fromRoute(route);
        if (routeSink.getId().equals(mSinkId)) {
            mRoute = route;
            break;
        }
    }

    if (mRoute == null) {
        reportError(String.format(ERROR_NEW_ROUTE_INVALID_SINK_URN, mSinkId));
        return;
    }

    mApiClient = createApiClient(mRoute, castApplicationListener, applicationContext);
    mApiClient.connect();
    mState = STATE_CONNECTING_TO_API;
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:41,代码来源:CreateRouteRequest.java

示例8: createApiClient

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private GoogleApiClient createApiClient(
        MediaRouter.RouteInfo route, Cast.Listener listener, Context context) {
    CastDevice selectedDevice = CastDevice.getFromBundle(route.getExtras());

    Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
            .builder(selectedDevice, listener)
            // TODO(avayvod): hide this behind the flag or remove
            .setVerboseLoggingEnabled(true);

    return new GoogleApiClient.Builder(context)
            .addApi(Cast.API, apiOptionsBuilder.build())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:16,代码来源:CreateRouteRequest.java

示例9: connect

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * GooglePlayServiceに接続し、Receiverアプリケーションを起動する.
 * 
 */
public void connect() {
    if (mApiClient != null && mIsApplicationDisconnected) {
        mIsApplicationDisconnected = false;
        launchApplication();
    }

    if (mApiClient == null) {
        mIsApplicationDisconnected = false;
        
        mCastListener = new Cast.Listener() {
            @Override
            public void onApplicationDisconnected(final int statusCode) {
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "onApplicationDisconnected$statusCode: " + statusCode);
                }
                mIsApplicationDisconnected = true;
            }
            @Override
            public void onApplicationStatusChanged() {
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "onApplicationStatusChanged");
                }
            }
        };

        Cast.CastOptions.Builder apiOptionsBuilder = 
                Cast.CastOptions.builder(mSelectedDevice, mCastListener);
        mApiClient = new GoogleApiClient.Builder(mContext)
                .addApi(Cast.API, apiOptionsBuilder.build())
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .build();
        mApiClient.connect();
    }
        

}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:42,代码来源:ChromeCastController.java

示例10: onRouteSelected

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
    mSelectedDevice = CastDevice.getFromBundle(info.getExtras());

    // Step 12
    mCastClientListener = new Cast.Listener() {
        @Override
        public void onApplicationStatusChanged() {
            if (mApiClient != null) {
                Log.d(TAG, "onApplicationStatusChanged: " + Cast.CastApi.getApplicationStatus(mApiClient));
            }
        }

        @Override
        public void onVolumeChanged() {
        }

        @Override
        public void onApplicationDisconnected(int errorCode) {
            teardown();
        }
    };

    // Step 9
    mConnectionCallbacks = new ConnectionCallbacks();
    mConnectionFailedListener = new ConnectionFailedListener();
    Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(mSelectedDevice, mCastClientListener);
    mApiClient = new GoogleApiClient.Builder(getApplicationContext()).addApi(Cast.API, apiOptionsBuilder.build()).addConnectionCallbacks(mConnectionCallbacks).addOnConnectionFailedListener(mConnectionFailedListener).build();

    // Step 10
    if (!mApiClient.isConnected()) {
        mApiClient.connect();
    }

    // Step 15
    Cast.CastOptions.builder(mSelectedDevice, mCastClientListener).setVerboseLoggingEnabled(true).build();
}
 
开发者ID:roys,项目名称:cast-codelab,代码行数:38,代码来源:CastActivity.java

示例11: createApiClient

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private GoogleApiClient createApiClient(Cast.Listener listener) {
    Cast.CastOptions.Builder apiOptionsBuilder =
            new Cast.CastOptions.Builder(mSink.getDevice(), listener)
                     // TODO(avayvod): hide this behind the flag or remove
                     .setVerboseLoggingEnabled(true);

    return new GoogleApiClient.Builder(ContextUtils.getApplicationContext())
            .addApi(Cast.API, apiOptionsBuilder.build())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:CreateRouteRequest.java

示例12: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Start the receiver app
 */
private void launchReceiver() {
	try {
		Cast.Listener mCastListener = new Cast.Listener() {
			@Override
			public void onApplicationDisconnected(int errorCode) {
				log("Application has stopped. Error code: " + errorCode);
				shutdownConnection();
			}
		};

		// Connect to Google Play services
		ConnectionCallbacks mConnectionCallbacks = new ConnectionCallbacks();
		ConnectionFailedListener mConnectionFailedListener = new ConnectionFailedListener();
		Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
				.builder(mSelectedDevice, mCastListener);
		mApiClient = new GoogleApiClient.Builder(context)
				.addApi(Cast.API, apiOptionsBuilder.build())
				.addConnectionCallbacks(mConnectionCallbacks)
				.addOnConnectionFailedListener(mConnectionFailedListener)
				.build();

		mApiClient.connect();
	} catch (Exception e) {
		log("Failed launchReceiver");
		e.printStackTrace();
	}
}
 
开发者ID:chteuchteu,项目名称:Munin-for-Android,代码行数:31,代码来源:ChromecastHelper.java

示例13: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Start the receiver app
 */
private void launchReceiver() {
    try {
        Cast.Listener castListener = new Cast.Listener() {

            @Override
            public void onApplicationDisconnected(int errorCode) {
                Log.d(TAG, "application has stopped");
                teardown(true);
            }

        };
        // Connect to Google Play services
        ConnectionCallbacks connectionCallbacks = new ConnectionCallbacks();
        ConnectionFailedListener connectionFailedListener = new ConnectionFailedListener();
        Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
                .builder(mState.selectedDevice, castListener);
        mState.apiClient = new GoogleApiClient.Builder(mActivity)
                .addApi(Cast.API, apiOptionsBuilder.build())
                .addConnectionCallbacks(connectionCallbacks)
                .addOnConnectionFailedListener(connectionFailedListener)
                .build();
        mState.apiClient.connect();
    } catch (Exception e) {
        Log.e(TAG, "Failed launchReceiver", e);
    }
}
 
开发者ID:manotaurgames,项目名称:castro-android,代码行数:30,代码来源:CastLogic.java

示例14: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
/**
 * Start the receiver app
 */
private void launchReceiver() {
	try {
		mCastListener = new Cast.Listener() {

			@Override
			public void onApplicationDisconnected(int errorCode) {
				Log.d(TAG, "application has stopped");
				teardown();
			}

		};
		// Connect to Google Play services
		mConnectionCallbacks = new ConnectionCallbacks();
		mConnectionFailedListener = new ConnectionFailedListener();
		Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
				.builder(mSelectedDevice, mCastListener);
		mApiClient = new GoogleApiClient.Builder(this)
				.addApi(Cast.API, apiOptionsBuilder.build())
				.addConnectionCallbacks(mConnectionCallbacks)
				.addOnConnectionFailedListener(mConnectionFailedListener)
				.build();

		mApiClient.connect();
	} catch (Exception e) {
		Log.e(TAG, "Failed launchReceiver", e);
	}
}
 
开发者ID:qhphan,项目名称:dojoandroidcast,代码行数:31,代码来源:MainActivity.java

示例15: launchReceiver

import com.google.android.gms.cast.Cast; //导入方法依赖的package包/类
private void launchReceiver() {
		try {
			mCastListener = new Cast.Listener() {

				@Override
				public void onApplicationDisconnected(int errorCode) {
					Log.d(TAG, "application has stopped");
//					teardown();
				}

			};
			// Connect to Google Play services
			mConnectionCallbacks = new ConnectionCallbacks();
			mConnectionFailedListener = new ConnectionFailedListener();
			Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
					.builder(mSelectedDevice, mCastListener);
			mApiClient = new GoogleApiClient.Builder(this)
					.addApi(Cast.API, apiOptionsBuilder.build())
					.addConnectionCallbacks(mConnectionCallbacks)
					.addOnConnectionFailedListener(mConnectionFailedListener)
					.build();

			mApiClient.connect();
		} catch (Exception e) {
			Log.e(TAG, "Failed launchReceiver", e);
		}
	}
 
开发者ID:qhphan,项目名称:dojoandroidcast,代码行数:28,代码来源:DojoSenderActivity.java


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