-
Notifications
You must be signed in to change notification settings - Fork 344
0x03b Network_en
If you use OkHttp to send network requests, you can add dependency to the project as following:
implementation 'cn.hikyson.godeye:godeye-okhttp:VERSION_NAME'
Use the following configuration to install
GodEye.instance().install(GodEyeConfig.defaultConfigBuilder().withNetworkConfig(new GodEyeConfig.NetworkConfig()).build());
or
<network />
Network module need to install after AndroidGodEye Version 3.0
The 'android-godeye-okhttp' module provides an utility for okhttp. Just set the interceptor and event monitoring for OkHttpClient:
OkNetworkCollectorFactory okNetworkCollectorFactory = new OkNetworkCollectorFactory();
OkHttpClient zygote = new OkHttpClient.Builder().eventListenerFactory(okNetworkCollectorFactory.addNetworkInterceptor(okNetworkCollectorFactory).build();
If you send network request by other client, you need to call GodEyeHelper.onNetworkEnd(NetworkInfo networkInfo)
to produce network data
Use the following methods to observe the output:
try {
GodEye.instance().observeModule(GodEye.ModuleName.NETWORK, new Consumer<NetworkInfo<HttpContent>>() {
@Override
public void accept(NetworkInfo<HttpContent> networkContentNetworkInfo) throws Exception {
}
});
} catch (UninstallException e) {
e.printStackTrace();
}
Callback after the end of each network request. networkContentNetworkInfo
records the results of the network, include result code, message, time-consuming of each stage, payload, etc
Debug Monitor Dashboard provides informations of whether the network is successful, result message, time-consuming and some other informations (such as connected IP, etc.)