Efiicient way to show 'Cant access network' View with 'Retry' and additional options like 'Wifi Settings', 'Mobile Network'

前端 未结 2 483
孤街浪徒
孤街浪徒 2021-02-02 04:46

I need to include this in my app

When should it get triggered?

  • Any action triggered by user from UI requires internet
相关标签:
2条回答
  • 2021-02-02 05:15

    Volley DETROYS all listeners as soon as it receives something from the server, regardless of whether the response is a proper response or an error response.

    A request needs to constructed everytime it should be sent or resent.

    These steps will help achieve it

    • Create a fragment with Retry and other necessary buttons like Wifi Settings, Mobile Network Settings
    • Create a full sized FrameLayout inside RelativeLayout on necessary views to accommodate the fragment created and hide it initially
    • When request fails, make the FrameLayout visible and the retry button should call the function that constructs and calls the request
    0 讨论(0)
  • 2021-02-02 05:22

    I have encountered the same needs and issues. I am working on a Volley based library jus where most the issues you have had i handle with rxJava global observables and of course Alerts class with static alerts/views generators. the connectivity handling I try to make it smooth using ConnectivityManager and NoConnectionPolicy concepts.

    0 讨论(0)
提交回复
热议问题