网络呼叫后,Retrofit + RxJava不会返回任何内容

时间:2015-12-02 18:03:07

标签: android retrofit rx-java

所以这是我的代码

RestAdapter restAdapter=new RestAdapter.Builder().setEndpoint(HelperFunctions.BASE_URL).build();
final ApiInterface apiInterface=restAdapter.create(ApiInterface.class);

apiInterface.submitDataToAnalyze("dataToAnalyze", "852741963", 1, uuid, dataToAnalyze.toString(), todayDate)
.onErrorReturn(new Func1<Throwable, BasicResponse>() {
    @Override
    public BasicResponse call(Throwable throwable) {
        Log.e(FILE_NAME, "masuk sini??");
        return null;
    }
 })
 .flatMap(new Func1<BasicResponse, Observable<LocationSuggestion>>() {
    @Override
    public Observable<LocationSuggestion> call(BasicResponse basicResponse) {
        Log.v(FILE_NAME, "basicResponse: " + basicResponse.toString());
        return Observable.just(null);
                                    }
    })
 .map(new Func1<LocationSuggestion, Integer>() {
      @Override
      public Integer call(LocationSuggestion suggestion) {
          Log.v(FILE_NAME, "eh sampai sini");
          return 1;
      }
  }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());

我的日志都没有显示在logcat中。如果我的网络通话(以及所有其他子顺序平面图或地图)工作正常,我该怎么办? Btw apiInterface.submitDataToAnalyze()应该将一些数据插入一个远程数据库(在这种情况下,它没有插入任何东西,因此我试图找出错误发生的位置)

0 个答案:

没有答案