AllenHuang

0

votes
0

answer
3

views

java.net.SocketTimeoutException occurred after 1s~3s but my ok http timeout set 10s

My app is using Retrofit+okhttp. Sometimes, it throw SocketTimeoutException just through 1s~3s after request but my okhttp timeout is setting 10s. It's my code. private static OkHttpClient getClient() { OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(10, TimeUnit.SECONDS) .writeTime...
AllenHuang
3

votes
0

answer
257

views

Keep service alive in Android Oreo like whatapp

How does wechat or whatapp show notification when receiving new message immediately? If background is killed , it can't do anything in background doesn't it? In most of country, we can use FCM. If user is in china, how to make the service still alive and receive data in background without FCM? My...
AllenHuang
-1

votes
4

answer
30

views

Retrofit2 GsonConverter Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $

I met some problem. I'm trying to get data from server like this.. { "Message": "", "StatusCode": 0, "Payload": [ [ { }, { } ], [ { }, { } ] ] } My BaseResponse is... @SerializedName("Message") @Expose private String Message; @SerializedName("StatusCode") @Expose private int StatusCode; @SerializedN...
AllenHuang