retrofit2

    0热度

    1回答

    我正在使用retorfit从Steam API获取数据,但我的响应为空,但日志显示正确的JSON响应。 这是从API的JSON: { "response": { "players": [ { "steamid": "76561197960435530", "communityvisibilitystate": 3, "profile

    0热度

    1回答

    我需要同步呼叫刷新Auth令牌,但我得到'NetworkOnMainThreadException'。 @Synchronized fun refreshToken(): String? { val refreshToken = AuthService.getRefreshToken(context) var id_token: String? = null va

    0热度

    1回答

    当我使用Retrofit进行API调用时,我得到了下面的JSON响应。 现在我想将数据映射到模型。什么是最好的方式来做到这一点?提前致谢。 编辑:这是真正的JSON响应。 { "status": "success", "data": { "messages": [], "result": { "clinicCode": "Medics", "firs

    -3热度

    1回答

    我能够在Retrofit中使用日志拦截器来获取响应,但我的onResponse没有被调用。 我使用的两个模型类如下所示,还有两个名为Result和JobTitle。 MainResponse.class public class MainResponse { @SerializedName("status") @Expose private String status; @Seriali

    2热度

    1回答

    我有post动态变量替换的url。所以在搜索了很多链接之后,我做了下面的代码。 @POST("clients/{clientId}/devices/{deviceCode}/authenticate") Call<String> isAuthenticate(@Path("clientId") Long clientId,@Path("deviceCode") String d

    0热度

    1回答

    我正在构建一个活动,我正在从api中加载对象列表。我需要使用retrofit进行多个请求,并返回不同的对象。我可以提出请求,但我不知道如何检查完成。 下面的代码是我。 ApiRepository public interface ApiRepository { @GET("/api/troopmarker.json") Call<List<TroopMarker>> getTr

    1热度

    2回答

    如何在将response.body()转换为POJO类时关闭response.body? public class RetrofitClient { private static Retrofit retrofit = null; private final static OkHttpClient okHttpClient = new OkHttpClient.Builder(

    1热度

    3回答

    我在我的应用程序中使用Retrofit从他的服务器下载一些JSON。但有些时候,当我从服务器请求重复的数据时,它会返回空主体响应代码208,但在200我有一个非空的响应正文。 在null身体改造去onFailure方法。我的问题在这里! 我想知道请求失败的原因(这是因为208(在我的情况下)或其他事情)。如何在OnFailure方法中获得响应代码? 我试图实现这样我自己的回调方法: public

    7热度

    2回答

    在正在工作的应用程序中突然出现协议异常,导致网络调用失败。 该应用程序工作到昨天和今天所有的网络通话失败。这些调用对HTTP正常工作,但使用HTTPS失败。 这里是日志, java.net.ProtocolException: Expected ':status' header not present 10-18 14:59:01.103 30746-30746/? W/System.err:

    0热度

    1回答

    在我的Android应用程序中我试图调用URL http://my-url.com/somestuff?type=type1。要创建此调用,我正在使用retrofit 2.3.0。根据Android的工作室,被称为URL是http://my-url.com/somestuff没有导致接收404 @GET("somestuff") Call<MyDataModel> getStuff( @