RxJava can also request networks as gracefully as a co program

RxJava can also request networks as gracefully as a co program Retrofit & coroutines and retrofit & rxjava I believe that everyone here can say a lot about the network request framework, but I'm not going to talk about the network request framework today. Let's talk about the difference bet ...

Posted by prawn_86 on Tue, 16 Jun 2020 01:36:20 -0700

Retrofit Simple Encapsulation

Retrofit Simple Encapsulation In a simple period, use a demo to show: build.gradle configuration file: compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.3.0' compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0' compile 'com.squareup.okhttp3:logging-interceptor:3.4.1' ...

Posted by jakeklem on Mon, 04 May 2020 11:55:58 -0700

Build MVC project from scratch

Preface This article mainly records how to build an MVP architecture. At the same time, it realizes the network request by combining with the mainstream frameworks such as Retrofit,RxJava,Okhttp, which is convenient for later review and rapid development. Project subcontracting Base: put some base classes, such a ...

Posted by VapiD on Sun, 03 May 2020 11:56:40 -0700

OkHttp implements automatic refresh of globally expired token s

#Problem encountered: App currently being developed has a problem: When an interface is requested, it will fail because the token is no longer valid.However, the product manager expects the app to refresh the token immediately and then repeat the request for the interface, which is insensitive to the user.>This means silent automatic login a ...

Posted by timandkitty on Tue, 28 Apr 2020 09:59:38 -0700

1, Login to register mvp framework

1, model layer writes an interface public interface IMyView { //How to login successfully void loginSuccess(); // Method of login failure void loginError(String error); //Get login name String getMobile(); //Get login password String getPassword(); } 2, The main method of model l ...

Posted by monotoko on Sun, 05 Apr 2020 16:28:07 -0700

Android flexible switch pull-down refresh (policy mode + reflection)

Recently, I want to change the pull-down to refresh, but I don't want to discard the previous one. I want to know whether both of them can coexist. Before using it, configure A to use A, and configure B to use B. (the principle is to control the use of corresponding strategies through reflection) It is very simple to use. You can directly swi ...

Posted by ShaileshD on Sun, 05 Apr 2020 06:05:10 -0700

Retrofit+BroadcastReceiver realizes the function of App version update

Preface: In the process of project development, there is generally a need for "version update". We can judge whether to upgrade according to the version code. Generally, for each version update, the version number is increased by one. If the version number on the get server is higher than the version number of this program, you will ...

Posted by PGTibs on Sat, 04 Apr 2020 22:30:56 -0700

Summary of okhttp 3.4.2 interceptor

I wrote one in 16 years Simple configuration of RxJava+Retrofit+OkHttp combination in network request , this article can be used as a supplement to it. As an important member of the okhttp interceptor, if we make good use of it, we will get twice the result with half the effort. First, let's look at the interceptor's core inte ...

Posted by krio on Fri, 03 Apr 2020 15:19:38 -0700

Operation mode of Retrofit2 under Kotlin project

Add dependency: Establish entity class to obtain network return data Describe the interface of the network request get mode: Post mode: Action to initiate request: Reference blog: http://blog.csdn.net/carson_ho/article/details/73732076 GitHub address: https://github.com/yangtianfu2018/Retrofit2Project Code ...

Posted by skiingguru1611 on Wed, 01 Apr 2020 17:36:14 -0700

[Android] Retrofit source code learning

[Android] Retrofit source code learningThe process of using Retrofit#Create a Retrofit object through Builder:CopyRetrofit retrofit = new Retrofit.Builder().baseUrl("").addConverterFactory().build();Using Java annotation to describe APICopypublic interface MyApi { @GET("/api") Call<Data> getData(); }Create api object and Call object throu ...

Posted by jdiver on Fri, 20 Mar 2020 04:34:57 -0700