How to catch the Exception in Retrofit android

后端 未结 2 2051
抹茶落季
抹茶落季 2021-01-29 02:52
  1. I have defined the classes as below.
  2. I have used dagger with Retrofit here

What I am trying to do::

I am trying to catch t

2条回答
  •  自闭症患者
    2021-01-29 03:35

    As far as I know, I don't think Retrofit supports 'connectivity checking in call time' and I don't think that is exactly what you want.

    Try to check connectivity before your call, for example,

    private void sendData() {
        if( isConnected ) {
              switch(call) {
                   case "userSignIn":
                          Call !
                          break;
                   ...
        }
    }
    

    Maybe you can check this solution too

提交回复
热议问题