当前位置: 首页>>代码示例>>Java>>正文


Java Util.postError方法代码示例

本文整理汇总了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();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:25,代码来源:NetcastTVService.java

示例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;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:24,代码来源:WebOSTVKeyboardInput.java

示例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();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:27,代码来源:WebOSTVService.java

示例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));
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:21,代码来源:CastWebAppSession.java

示例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));
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:9,代码来源:WebOSTVService.java

示例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());
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:10,代码来源:NetcastTVService.java

示例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));
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:11,代码来源:CastService.java

示例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));
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:10,代码来源:DIALService.java

示例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);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:35,代码来源:CastService.java

示例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");
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:30,代码来源:NetcastTVService.java

示例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);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:13,代码来源:DIALService.java

示例12: subscribeAppState

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public ServiceSubscription<AppStateListener> subscribeAppState(LaunchSession launchSession, AppStateListener listener) {
    Util.postError(listener, ServiceCommandError.notSupported());

    return null;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:7,代码来源:NetcastTVService.java

示例13: getPlayState

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getPlayState(PlayStateListener listener) {
    Util.postError(listener, ServiceCommandError.notSupported());
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:5,代码来源:RokuService.java

示例14: getMediaInfo

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMediaInfo(MediaInfoListener listener) {
    Util.postError(listener, ServiceCommandError.notSupported());
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:5,代码来源:WebAppSession.java

示例15: getPosition

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getPosition(PositionListener listener) {
    Util.postError(listener, ServiceCommandError.notSupported());
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:5,代码来源:RokuService.java


注:本文中的com.connectsdk.core.Util.postError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。