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


Java LaunchSession.setSessionId方法代码示例

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


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

示例1: launchAppWithInfo

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void launchAppWithInfo(final AppInfo appInfo, Object params, final AppLaunchListener listener) {
    ServiceCommand<ResponseListener<Object>> command =
            new ServiceCommand<ResponseListener<Object>>(getCommandProcessor(),
                    requestURL(appInfo.getName()), params, new ResponseListener<Object>() {
        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, new ServiceCommandError(0, "Problem Launching app", null));
        }

        @Override
        public void onSuccess(Object object) {
            LaunchSession launchSession = LaunchSession.launchSessionForAppId(appInfo.getId());
            launchSession.setAppName(appInfo.getName());
            launchSession.setSessionId((String)object);
            launchSession.setService(DIALService.this);
            launchSession.setSessionType(LaunchSessionType.App);

            Util.postSuccess(listener, launchSession);
        }
    });

    command.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:25,代码来源:DIALService.java

示例2: displayMedia

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
private void displayMedia(JSONObject params, final MediaPlayer.LaunchListener listener) {
    String uri = "ssap://media.viewer/open";

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {
        @Override
        public void onSuccess(Object response) {
            JSONObject obj = (JSONObject) response;

            LaunchSession launchSession = LaunchSession.launchSessionForAppId(obj.optString("id"));
            launchSession.setService(WebOSTVService.this);
            launchSession.setSessionId(obj.optString("sessionId"));
            launchSession.setSessionType(LaunchSessionType.Media);

            Util.postSuccess(listener, new MediaLaunchObject(launchSession, WebOSTVService.this));
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, params, true, responseListener);
    request.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:26,代码来源:WebOSTVService.java

示例3: launchAppWithInfo

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void launchAppWithInfo(final AppInfo appInfo, Object params, final AppLaunchListener listener) {
    ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(this, requestURL(appInfo.getName()), params, new ResponseListener<Object>() {
        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, new ServiceCommandError(0, "Problem Launching app", null));
        }

        @Override
        public void onSuccess(Object object) {
            LaunchSession launchSession = LaunchSession.launchSessionForAppId(appInfo.getId());
            launchSession.setAppName(appInfo.getName());
            launchSession.setSessionId((String)object);
            launchSession.setService(DIALService.this);
            launchSession.setSessionType(LaunchSessionType.App);

            Util.postSuccess(listener, launchSession);
        }
    });

    command.send();
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:23,代码来源:DIALService.java

示例4: onResult

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void onResult(ApplicationConnectionResult result) {
    Status status = result.getStatus();

    if (status.isSuccess()) {
        ApplicationMetadata applicationMetadata = result.getApplicationMetadata();
        currentAppId = applicationMetadata.getApplicationId();

        LaunchSession launchSession = LaunchSession.launchSessionForAppId(applicationMetadata.getApplicationId());
        launchSession.setAppName(applicationMetadata.getName());
        launchSession.setSessionId(result.getSessionId());
        launchSession.setSessionType(LaunchSessionType.WebApp);
        launchSession.setService(CastService.this);

        CastWebAppSession webAppSession = new CastWebAppSession(launchSession, CastService.this);
        webAppSession.setMetadata(applicationMetadata);

        sessions.put(applicationMetadata.getApplicationId(), webAppSession);

        if (listener != null) {
            listener.onSuccess(webAppSession);
        }

        launchingAppId = null;
    }
    else {
        if (listener != null) {
            listener.onFailure(new ServiceCommandError(status.getStatusCode(), status.getStatusMessage(), status));
        }
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:32,代码来源:CastService.java

示例5: launchBrowser

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void launchBrowser(String url, final Launcher.AppLaunchListener listener) {
    String uri = "ssap://system.launcher/open";
    JSONObject payload = new JSONObject();

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            JSONObject obj = (JSONObject) response;
            LaunchSession launchSession = new LaunchSession();

            launchSession.setService(WebOSTVService.this);
            launchSession.setAppId(obj.optString("id")); // note that response uses id to mean appId
            launchSession.setSessionId(obj.optString("sessionId"));
            launchSession.setSessionType(LaunchSessionType.App);
            launchSession.setRawData(obj);

            Util.postSuccess(listener, launchSession);
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    try {
        payload.put("target", url);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, payload, true, responseListener);
    request.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:37,代码来源:WebOSTVService.java


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