com.google.android.gms.cast.framework.SessionManager Java Examples

The following examples show how to use com.google.android.gms.cast.framework.SessionManager. 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: GoogleCastModule.java    From react-native-google-cast with MIT License 6 votes vote down vote up
@ReactMethod
public void endSession(final boolean stopCasting, final Promise promise) {
    getReactApplicationContext().runOnUiQueueThread(new Runnable() {
        @Override
        public void run() {
            if (CAST_AVAILABLE) {
                SessionManager sessionManager =
                    CastContext.getSharedInstance(getReactApplicationContext())
                            .getSessionManager();
                sessionManager.endCurrentSession(stopCasting);
                promise.resolve(true);
            } else {
                promise.reject(E_CAST_NOT_AVAILABLE, GOOGLE_CAST_NOT_AVAILABLE_MESSAGE);
            }
        }
    });
}
 
Example #2
Source File: GoogleCastModule.java    From react-native-google-cast with MIT License 5 votes vote down vote up
@Override
public void onHostResume() {
    getReactApplicationContext().runOnUiQueueThread(new Runnable() {
        @Override
        public void run() {
            SessionManager sessionManager =
                    CastContext.getSharedInstance(getReactApplicationContext())
                            .getSessionManager();
            sessionManager.addSessionManagerListener(mSessionManagerListener,
                    CastSession.class);
        }
    });
}
 
Example #3
Source File: GoogleCastModule.java    From react-native-google-cast with MIT License 5 votes vote down vote up
@Override
public void onHostPause() {
    getReactApplicationContext().runOnUiQueueThread(new Runnable() {
        @Override
        public void run() {
            SessionManager sessionManager =
                    CastContext.getSharedInstance(getReactApplicationContext())
                            .getSessionManager();
            sessionManager.removeSessionManagerListener(mSessionManagerListener,
                    CastSession.class);
        }
    });
}
 
Example #4
Source File: VinylCastApplication.java    From vinyl-cast with MIT License 4 votes vote down vote up
public SessionManager getCastSessionManager() {
    return castSessionManager;
}