flender
flender copied to clipboard
Dynamic network type
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.
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
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.
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.
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)
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
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.
Ooooh I get what you are saying now. I'm gonna see how I can integrate such a feature.