本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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));
}
}
}
示例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();
}