本文整理汇总了Java中com.connectsdk.service.sessions.LaunchSession.getAppId方法的典型用法代码示例。如果您正苦于以下问题:Java LaunchSession.getAppId方法的具体用法?Java LaunchSession.getAppId怎么用?Java LaunchSession.getAppId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.service.sessions.LaunchSession
的用法示例。
在下文中一共展示了LaunchSession.getAppId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeApp
import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void closeApp(LaunchSession launchSession, ResponseListener<Object> listener) {
String uri = "ssap://system.launcher/close";
String appId = launchSession.getAppId();
String sessionId = launchSession.getSessionId();
JSONObject payload = new JSONObject();
try {
payload.put("id", appId);
payload.put("sessionId", sessionId);
} catch (JSONException e) {
e.printStackTrace();
}
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(launchSession.getService(), uri, payload, true, listener);
request.send();
}
示例2: closeMedia
import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@Override
public void closeMedia(LaunchSession launchSession, ResponseListener<Object> listener) {
JSONObject payload = new JSONObject();
try {
if (launchSession.getAppId() != null && launchSession.getAppId().length() > 0)
payload.put("id", launchSession.getAppId());
if (launchSession.getSessionId() != null && launchSession.getSessionId().length() > 0)
payload.put("sessionId", launchSession.getSessionId());
} catch (JSONException e) {
e.printStackTrace();
}
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(launchSession.getService(), CLOSE_MEDIA_URI, payload, true, listener);
request.send();
}
示例3: closeWebApp
import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的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();
}
示例4: sendMessage
import com.connectsdk.service.sessions.LaunchSession; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private void sendMessage(Object message, LaunchSession launchSession, ResponseListener<Object> listener) {
if (launchSession == null || launchSession.getAppId() == null) {
Util.postError(listener, new ServiceCommandError(0, "Must provide a valid LaunchSession object", null));
return;
}
if (message == null) {
Util.postError(listener, new ServiceCommandError(0, "Cannot send a null message", null));
return;
}
if (socket == null) {
connect();
}
String appId = launchSession.getAppId();
String fullAppId = appId;
if (launchSession.getSessionType() == LaunchSessionType.WebApp)
fullAppId = mAppToAppIdMappings.get(appId);
if (fullAppId == null || fullAppId.length() == 0) {
Util.postError(listener, new ServiceCommandError(-1, "You must provide a valid LaunchSession to send messages to", null));
return;
}
JSONObject payload = new JSONObject();
try {
payload.put("type", "p2p");
payload.put("to", fullAppId);
payload.put("payload", message);
} catch (JSONException e) {
e.printStackTrace();
}
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, null, payload, true, listener);
sendCommand(request);
}