flender icon indicating copy to clipboard operation
flender copied to clipboard

Dynamic network type

Open pawelantczak opened this issue 10 years ago • 7 comments

Hello. It is common, that you give users possibility to choose, if they wants to use only wifi or mobile as well. Is it possible, to specify net type dynamically? Via Flender. or as annotation parameter? Regards.

pawelantczak avatar Jul 05 '15 17:07 pawelantczak

Flender allows this. If you scroll down to the usage section of the readme you will see that there are annotation for mobile and WiFi. @MobileRequired and @WiFiRequired

jd-alexander avatar Jul 05 '15 17:07 jd-alexander

Thanks, but. I don't want to explicitly set net type. I want to give user possibility to pick which net type he wants to use.

pawelantczak avatar Jul 05 '15 17:07 pawelantczak

What exactly are you trying to accomplish? The purpose of this library is simply for the developer to annotate method that require internet access so they won't execute if none is detected and a toast (or something custom) is shown.

jd-alexander avatar Jul 05 '15 17:07 jd-alexander

Exactly that + to be able to specify which network can app use. In countries where mobile net is expensive, users often don't want your app to use mobile connection and allows only wifi connection. My idea was, to have something like @InternetRequired(requiredNetwork = "wifi"): execute method only if user is connected to wifi and show toast if not. or set it globally Flender.setRequiredNetwork(Flender.WiFi)

pawelantczak avatar Jul 05 '15 17:07 pawelantczak

Oh ok. That's what I'm saying. Flender does support that use case. If you just @WiFiRequired that's exactly what happens. A toast is shown that WiFi isn't available.

@InternetReqired checks for general internet.

@WiFiRequired checks if WiFi is available

@MobileRequired checks if mobile network is available

jd-alexander avatar Jul 05 '15 18:07 jd-alexander

Heh. Yes. But, I don't know during development time, which net type method should use. It is up to user, during runtime, to decide that. If he picks "I want you to use wifi only", I want to have possibility to pass this information to your library.

pawelantczak avatar Jul 05 '15 18:07 pawelantczak

Ooooh I get what you are saying now. I'm gonna see how I can integrate such a feature.

jd-alexander avatar Jul 05 '15 18:07 jd-alexander