本文整理汇总了Java中com.connectsdk.core.Util.postError方法的典型用法代码示例。如果您正苦于以下问题:Java Util.postError方法的具体用法?Java Util.postError怎么用?Java Util.postError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.core.Util
的用法示例。
在下文中一共展示了Util.postError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTotalNumberOfApplications
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void getTotalNumberOfApplications(int type, final AppCountListener listener) {
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
String strObj = (String) response;
int applicationNumber = parseAppNumberXmlToJSON(strObj);
Util.postSuccess(listener, applicationNumber);
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
String requestURL = getUDAPRequestURL(UDAP_PATH_DATA, TARGET_APPNUM_GET, String.valueOf(type));
ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(this, requestURL, null, responseListener);
command.setHttpMethod(ServiceCommand.TYPE_GET);
command.send();
}
示例2: connect
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public URLServiceSubscription<TextInputStatusListener> connect(final TextInputStatusListener listener) {
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
JSONObject jsonObj = (JSONObject)response;
TextInputStatusInfo keyboard = parseRawKeyboardData(jsonObj);
Util.postSuccess(listener, keyboard);
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
URLServiceSubscription<TextInputStatusListener> subscription = new URLServiceSubscription<TextInputStatusListener>(service, KEYBOARD_INPUT, null, true, responseListener);
subscription.send();
return subscription;
}
示例3: getACRAuthToken
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void getACRAuthToken(final ACRAuthTokenListener listener) {
String uri = "ssap://tv/getACRAuthToken";
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
try {
JSONObject jsonObj = (JSONObject) response;
String authToken = (String) jsonObj.get("token");
Util.postSuccess(listener, authToken);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, null, true, responseListener);
request.send();
}
示例4: connect
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void connect(final ResponseListener<Object> listener) {
if (castServiceChannel != null) {
disconnectFromWebApp();
}
castServiceChannel = new CastServiceChannel(launchSession.getAppId(), this);
try {
Cast.CastApi.setMessageReceivedCallbacks(service.getApiClient(),
castServiceChannel.getNamespace(),
castServiceChannel);
Util.postSuccess(listener, null);
} catch (IOException e) {
castServiceChannel = null;
Util.postError(listener, new ServiceCommandError(0, "Failed to create channel", null));
}
}
示例5: sendMessage
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void sendMessage(String message, LaunchSession launchSession, ResponseListener<Object> listener) {
if (message != null && message.length() > 0) {
sendMessage((Object) message, launchSession, listener);
}
else {
Util.postError(listener, new ServiceCommandError(0, "Cannot send a null message", null));
}
}
示例6: seek
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void seek(long position, ResponseListener<Object> listener) {
if (getDLNAService() != null) {
getDLNAService().seek(position, listener);
} else {
if (listener != null)
Util.postError(listener, ServiceCommandError.notSupported());
}
}
示例7: getPlayState
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getPlayState(PlayStateListener listener) {
if (mMediaPlayer != null && mMediaPlayer.getMediaStatus() != null) {
PlayStateStatus status = PlayStateStatus.convertPlayerStateToPlayStateStatus(mMediaPlayer.getMediaStatus().getPlayerState());
Util.postSuccess(listener, status);
}
else {
Util.postError(listener, new ServiceCommandError(0, "There is no media currently available", null));
}
}
示例8: closeLaunchSession
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void closeLaunchSession(LaunchSession launchSession, ResponseListener<Object> listener) {
if (launchSession.getSessionType() == LaunchSessionType.App) {
this.getLauncher().closeApp(launchSession, listener);
} else
{
Util.postError(listener, new ServiceCommandError(-1, "Could not find a launcher associated with this LaunchSession", launchSession));
}
}
示例9: seek
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void seek(final long position, final ResponseListener<Object> listener) {
if (mMediaPlayer == null || mMediaPlayer.getMediaStatus() == null) {
Util.postError(listener, new ServiceCommandError(0, "There is no media currently available", null));
return;
}
ConnectionListener connectionListener = new ConnectionListener() {
@Override
public void onConnected() {
try {
mMediaPlayer.seek(mApiClient, position, RemoteMediaPlayer.RESUME_STATE_UNCHANGED).setResultCallback(
new ResultCallback<MediaChannelResult>() {
@Override
public void onResult(MediaChannelResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
Util.postSuccess(listener, null);
} else {
Util.postError(listener, new ServiceCommandError(status.getStatusCode(), status.getStatusMessage(), status));
}
}
});
} catch (Exception e) {
Util.postError(listener, new ServiceCommandError(0, "Unable to seek", null));
}
}
};
runCommand(connectionListener);
}
示例10: playMedia
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, final MediaPlayer.LaunchListener listener) {
if (getDLNAService() != null) {
final MediaPlayer.LaunchListener launchListener = new LaunchListener() {
@Override
public void onError(ServiceCommandError error) {
if (listener != null)
Util.postError(listener, error);
}
@Override
public void onSuccess(MediaLaunchObject object) {
object.launchSession.setAppId(SMART_SHARE);
object.launchSession.setAppName(SMART_SHARE);
object.mediaControl = NetcastTVService.this.getMediaControl();
if (listener != null)
Util.postSuccess(listener, object);
}
};
getDLNAService().playMedia(mediaInfo, shouldLoop, launchListener);
}
else {
System.err.println("DLNA Service is not ready yet");
}
}
示例11: launchApp
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void launchApp(String appId, JSONObject params, AppLaunchListener listener) {
if (appId == null || appId.length() == 0) {
Util.postError(listener, new ServiceCommandError(0, "Must pass a valid appId", null));
return;
}
AppInfo appInfo = new AppInfo();
appInfo.setName(appId);
appInfo.setId(appId);
launchAppWithInfo(appInfo, listener);
}
示例12: subscribeAppState
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public ServiceSubscription<AppStateListener> subscribeAppState(LaunchSession launchSession, AppStateListener listener) {
Util.postError(listener, ServiceCommandError.notSupported());
return null;
}
示例13: getPlayState
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getPlayState(PlayStateListener listener) {
Util.postError(listener, ServiceCommandError.notSupported());
}
示例14: getMediaInfo
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMediaInfo(MediaInfoListener listener) {
Util.postError(listener, ServiceCommandError.notSupported());
}
示例15: getPosition
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getPosition(PositionListener listener) {
Util.postError(listener, ServiceCommandError.notSupported());
}