DigitalCampus/oppia-mobile-android

Network type may not be being verified in methods

Opened this issue · 0 comments

Dear Developer!

My name is Alejandro Mazuera-Rozo, I am a PhD Student at Universidad de los Andes, and at Università della Svizzera italiana. 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:

  1. https://developer.android.com/training/basics/network-ops/managing
  2. https://developer.android.com/training/efficient-downloads/connectivity_patterns

Potential Code Location without Network type validation

private boolean downloadCourseFile(String fileUrl, String shortname, Double versionID){

protected HashMap<String, String> doInBackground(Void... params) {

protected EntityResult<User> doInBackground(User... params) {

private boolean sendTrackers(User user, String dataToSend, boolean isRaw, BasicResult result){