本文整理匯總了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();
}
}