-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Dear Developer!
My name is Camilo Escobar, I am a PhD Student at Universidad de los Andes, Colombia. I am part of a research on the usage of network libraries within android apps. As a result of this we identified that there is a missing validation of network type within a method since some network operations are being performed in it. As you might know, a device can have various types of network connections. For the full list of possible network types, see https://developer.android.com/reference/android/net/ConnectivityManager. Therefore it is recommended for the app to identify the type of network available before performing a network operation.
Note: Wi-Fi is typically faster. Also, mobile data is often metered, which can get expensive. A common strategy for apps is to only fetch large data if a Wi-Fi network is available.
In order to address this issue we recommend you to visit:
- https://developer.android.com/training/basics/network-ops/managing
- https://developer.android.com/training/efficient-downloads/connectivity_patterns
Potential Code Location without Network type validation
simlar-android/app/src/main/java/org/simlar/https/HttpsPost.java
Lines 79 to 85 in 6af259d
| public static HttpsURLConnection createConnection(final String urlPath, final boolean multiPart) | |
| { | |
| //noinspection OverlyBroadCatchBlock | |
| try { | |
| final URL url = new URL(SERVER_URL + '/' + urlPath); | |
| final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); |