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