Java Code Examples for com.google.android.gms.cast.framework.CastState#CONNECTING

The following examples show how to use com.google.android.gms.cast.framework.CastState#CONNECTING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamFragment.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCastStateChanged(int i) {
    switch (i) {
        case CastState.CONNECTED:
            CastSession session = mCastContext != null ? mCastContext.getSessionManager().getCurrentCastSession() : null;
            if (session == null) break;
            castingTextView.setText(getString(R.string.stream_chromecast_playing, session.getCastDevice().getFriendlyName()));
            break;

        case CastState.CONNECTING:
            castingTextView.setText(getString(R.string.stream_chromecast_connecting));
            break;

        default:
            break;
    }
}
 
Example 2
Source File: MainActivity.java    From AndroidDemoProjects with Apache License 2.0 6 votes vote down vote up
@Override
public void onCastStateChanged(int newState) {
    Log.e("Tuts+", "onCastStateChanged");

    switch( newState ) {
        case CastState.CONNECTED: {

            break;
        } case CastState.CONNECTING: {

            break;
        } case CastState.NOT_CONNECTED: {

            break;
        } case CastState.NO_DEVICES_AVAILABLE: {

        }
    }

    if (newState != CastState.NO_DEVICES_AVAILABLE) {
        showIntroductoryOverlay();
    }
}