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


Java LaunchSession.setService方法代码示例

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


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

示例2: connectToApp

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
public void connectToApp(String appId, final WebAppSession.LaunchListener listener) {
    LaunchSession launchSession = LaunchSession.launchSessionForAppId(appId);
    launchSession.setSessionType(LaunchSessionType.App);
    launchSession.setService(this);

    final WebOSWebAppSession webAppSession = webAppSessionForLaunchSession(launchSession);

    connectToWebApp(webAppSession, false, new ResponseListener<Object>() {
        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }

        @Override
        public void onSuccess(Object object) {
            Util.postSuccess(listener, webAppSession);
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:20,代码来源: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>>(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

示例4: 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:PTCE,项目名称:popcorn-android,代码行数:26,代码来源:WebOSTVService.java

示例5: joinApp

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
public void joinApp(String appId, WebAppSession.LaunchListener listener) {
    LaunchSession launchSession = LaunchSession.launchSessionForAppId(appId);
    launchSession.setSessionType(LaunchSessionType.App);
    launchSession.setService(this);

    joinWebApp(launchSession, listener);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:8,代码来源:WebOSTVService.java

示例6: 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

示例7: playVideo

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
public void playVideo(final String url, String mimeType, String title,
        String description, String iconSrc, boolean shouldLoop,
        final LaunchListener listener) {

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

        @Override
        public void onSuccess(Object response) {
            LaunchSession launchSession = new LaunchSession();
            launchSession.setService(AirPlayService.this);
            launchSession.setSessionType(LaunchSessionType.Media);

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

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

    String uri = getRequestURL("play");
    String payload = null;

    PListBuilder builder = new PListBuilder();
    builder.putString("Content-Location", url);
    builder.putReal("Start-Position", 0);

    payload = builder.toString();

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

示例8: 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:PTCE,项目名称:popcorn-android,代码行数:37,代码来源:WebOSTVService.java

示例9: joinWebApp

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void joinWebApp(String webAppId, WebAppSession.LaunchListener listener) {
    LaunchSession launchSession = LaunchSession.launchSessionForAppId(webAppId);
    launchSession.setSessionType(LaunchSessionType.WebApp);
    launchSession.setService(this);

    joinWebApp(launchSession, listener);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:9,代码来源:WebOSTVService.java

示例10: getLaunchSession

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
LaunchSession getLaunchSession(JSONObject obj) {
    LaunchSession session = LaunchSession.launchSessionFromJSONObject(obj);
    String serviceName = obj.optString("serviceName");
    DeviceService service = serviceName != null ? device.getServiceByName(serviceName) : null;

    if (service != null) {
        session.setService(service);
    }

    return session;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:12,代码来源:JSCommandDispatcher.java

示例11: createMediaLaunchObject

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
private MediaLaunchObject createMediaLaunchObject() {
    LaunchSession launchSession = new LaunchSession();
    launchSession.setService(this);
    launchSession.setSessionType(LaunchSession.LaunchSessionType.Media);
    launchSession.setAppId(remoteMediaPlayer.getUniqueIdentifier());
    launchSession.setAppName(remoteMediaPlayer.getName());
    MediaLaunchObject mediaLaunchObject = new MediaLaunchObject(launchSession, this);
    return mediaLaunchObject;
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:10,代码来源:FireTVService.java

示例12: decodeLaunchSession

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public LaunchSession decodeLaunchSession(String type, JSONObject sessionObj) throws JSONException {
    if (type.equals("dlna")) {
        LaunchSession launchSession = LaunchSession.launchSessionFromJSONObject(sessionObj);
        launchSession.setService(this);

        return launchSession;
    }
    return null;
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:11,代码来源:DLNAService.java

示例13: launchAppStore

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void launchAppStore(final String appId, final AppLaunchListener listener) {
    if (!serviceDescription.getModelNumber().equals("4.0")) {
        launchApp("LG Smart World", listener);  // TODO: this will not work in Korea, use Korean name instead
        return;
    }

    String targetPath = getUDAPRequestURL(ROAP_PATH_APP_STORE);

    Map<String, String> params = new HashMap<String, String>();
    params.put("name", "SearchCMDPlaySDPContent");
    params.put("content_type", "4");
    params.put("conts_exec_type", "");
    params.put("conts_plex_type_flag", "");
    params.put("conts_search_id", "");
    params.put("conts_age", "12");
    params.put("exec_id", "");
    params.put("item_id", HttpMessage.encode(appId));
    params.put("app_type", "S");

    String httpMessage = getUDAPMessageBody(UDAP_API_COMMAND, params);

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

        @Override
        public void onSuccess(Object response) {
            LaunchSession launchSession = LaunchSession.launchSessionForAppId(appId);
            launchSession.setAppName("LG Smart World"); // TODO: this will not work in Korea, use Korean name instead
            launchSession.setService(NetcastTVService.this);
            launchSession.setSessionType(LaunchSessionType.App);

            Util.postSuccess(listener, launchSession);
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };
    ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(this, targetPath, httpMessage, responseListener);
    command.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:43,代码来源:NetcastTVService.java

示例14: displayMedia

import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
private void displayMedia(String url, String mimeType, String title,
        String description, String iconSrc,
        final MediaPlayer.LaunchListener listener) {
    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            LaunchSession launchSession = new RokuLaunchSession();
            launchSession.setService(RokuService.this);
            launchSession.setSessionType(LaunchSession.LaunchSessionType.Media);
            Util.postSuccess(listener, new MediaLaunchObject(launchSession, RokuService.this));
        }

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

    String action = "input";
    String mediaFormat = mimeType;
    if (mimeType.contains("/")) {
        int index = mimeType.indexOf("/") + 1;
        mediaFormat = mimeType.substring(index);
    }

    String param;
    if (mimeType.contains("image")) {
        param = String.format("15985?t=p&u=%s&tr=crossfade", HttpMessage.encode(url));
    } else if (mimeType.contains("video")) {
        param = String.format(
                "15985?t=v&u=%s&k=(null)&videoName=%s&videoFormat=%s",
                HttpMessage.encode(url),
                TextUtils.isEmpty(title) ? "(null)" : HttpMessage.encode(title),
                        HttpMessage.encode(mediaFormat));
    } else { // if (mimeType.contains("audio")) {
        param = String
                .format("15985?t=a&u=%s&k=(null)&songname=%s&artistname=%s&songformat=%s&albumarturl=%s",
                        HttpMessage.encode(url),
                        TextUtils.isEmpty(title) ? "(null)" : HttpMessage.encode(title),
                        TextUtils.isEmpty(description) ? "(null)" : HttpMessage.encode(description),
                        HttpMessage.encode(mediaFormat),
                        TextUtils.isEmpty(iconSrc) ? "(null)" : HttpMessage.encode(iconSrc));
    }

    String uri = requestURL(action, param);

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


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