本文整理汇总了Java中com.connectsdk.service.sessions.LaunchSession.setAppId方法的典型用法代码示例。如果您正苦于以下问题:Java LaunchSession.setAppId方法的具体用法?Java LaunchSession.setAppId怎么用?Java LaunchSession.setAppId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.service.sessions.LaunchSession
的用法示例。
在下文中一共展示了LaunchSession.setAppId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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;
}