本文整理汇总了Java中com.connectsdk.service.sessions.WebOSWebAppSession.disconnectFromWebApp方法的典型用法代码示例。如果您正苦于以下问题:Java WebOSWebAppSession.disconnectFromWebApp方法的具体用法?Java WebOSWebAppSession.disconnectFromWebApp怎么用?Java WebOSWebAppSession.disconnectFromWebApp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.service.sessions.WebOSWebAppSession
的用法示例。
在下文中一共展示了WebOSWebAppSession.disconnectFromWebApp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeWebApp
import com.connectsdk.service.sessions.WebOSWebAppSession; //导入方法依赖的package包/类
@Override
public void closeWebApp(LaunchSession launchSession, final ResponseListener<Object> listener) {
if (launchSession == null || launchSession.getAppId() == null || launchSession.getAppId().length() == 0) {
Util.postError(listener, new ServiceCommandError(0, "Must provide a valid launch session", null));
return;
}
final WebOSWebAppSession webAppSession = mWebAppSessions.get(launchSession.getAppId());
if (webAppSession != null) {
webAppSession.disconnectFromWebApp();
}
String uri = "ssap://webapp/closeWebApp";
JSONObject payload = new JSONObject();
try {
if (launchSession.getAppId() != null) payload.put("webAppId", launchSession.getAppId());
if (launchSession.getSessionId() != null) payload.put("sessionId", launchSession.getSessionId());
} catch (JSONException e) {
e.printStackTrace();
}
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, payload, true, listener);
request.send();
}
示例2: disconnect
import com.connectsdk.service.sessions.WebOSWebAppSession; //导入方法依赖的package包/类
@Override
public void disconnect() {
Log.d(Util.T, "attempting to disconnect to " + serviceDescription.getIpAddress());
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null)
listener.onDisconnect(WebOSTVService.this, null);
}
});
if (socket != null) {
socket.setListener(null);
socket.disconnect();
socket = null;
}
if (mAppToAppIdMappings != null)
mAppToAppIdMappings.clear();
if (mWebAppSessions != null) {
Enumeration<WebOSWebAppSession> iterator = mWebAppSessions.elements();
while (iterator.hasMoreElements()) {
WebOSWebAppSession session = iterator.nextElement();
session.disconnectFromWebApp();
}
mWebAppSessions.clear();
}
}