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


Java LaunchSession.getService方法代码示例

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


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

示例1: closeApp

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void closeApp(LaunchSession launchSession, ResponseListener<Object> listener) {
    String uri = "ssap://system.launcher/close";
    String appId = launchSession.getAppId();
    String sessionId = launchSession.getSessionId();

    JSONObject payload = new JSONObject();

    try {
        payload.put("id", appId);
        payload.put("sessionId", sessionId);
    } catch (JSONException e) {
        e.printStackTrace();
    }

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

示例2: closeMedia

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void closeMedia(LaunchSession launchSession, ResponseListener<Object> listener) {
    JSONObject payload = new JSONObject();

    try {
        if (launchSession.getAppId() != null && launchSession.getAppId().length() > 0)
            payload.put("id", launchSession.getAppId());

        if (launchSession.getSessionId() != null && launchSession.getSessionId().length() > 0)
            payload.put("sessionId", launchSession.getSessionId());
    } catch (JSONException e) {
        e.printStackTrace();
    }

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

示例3: closeLaunchSession

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
/**
 * Closes the session on the first screen device. Depending on the sessionType, the associated service will have different ways of handling the close functionality.
 *
 * @param launchSession LaunchSession to close
 * @param listener (optional) listener to be called on success/failure
 */
public void closeLaunchSession(LaunchSession launchSession, ResponseListener<Object> listener) {
    if (launchSession == null) {
        Util.postError(listener, new ServiceCommandError(0, "You must provide a valid LaunchSession", null));
        return;
    }

    DeviceService service = launchSession.getService();
    if (service == null) {
        Util.postError(listener, new ServiceCommandError(0, "There is no service attached to this launch session", null));
        return;
    }

    switch (launchSession.getSessionType()) {
    case App:
        if (service instanceof Launcher)
            ((Launcher) service).closeApp(launchSession, listener);
        break;
    case Media:
        if (service instanceof MediaPlayer)
            ((MediaPlayer) service).closeMedia(launchSession, listener);
        break;
    case ExternalInputPicker:
        if (service instanceof ExternalInputControl)
            ((ExternalInputControl) service).closeInputPicker(launchSession, listener);
        break;
    case WebApp:
        if (service instanceof WebAppLauncher)
            ((WebAppLauncher) service).closeWebApp(launchSession, listener);
        break;
    case Unknown:
    default:
        Util.postError(listener, new ServiceCommandError(0, "This DeviceService does not know ho to close this LaunchSession", null));
        break;
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:42,代码来源:DeviceService.java

示例4: closeApp

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void closeApp(LaunchSession launchSession, ResponseListener<Object> listener) {
    String requestURL = getUDAPRequestURL(UDAP_PATH_APPTOAPP_COMMAND);

    Map <String,String> params = new HashMap<String,String>();
    params.put("name", "AppTerminate");
    params.put("auid", launchSession.getAppId());
    if (launchSession.getAppName() != null) 
        params.put("appname", HttpMessage.encode(launchSession.getAppName()));

    String httpMessage = getUDAPMessageBody(UDAP_API_COMMAND, params);

    ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(launchSession.getService(), requestURL, httpMessage, listener);
    command.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:16,代码来源:NetcastTVService.java

示例5: closeMedia

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void closeMedia(LaunchSession launchSession, ResponseListener<Object> listener) {
    if (launchSession.getService() instanceof DLNAService)
        ((DLNAService) launchSession.getService()).stop(listener);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:6,代码来源:DLNAService.java


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