Skip to content

Google Summer Of Code 2019: My journey

Adeel Zafar edited this page Aug 22, 2019 · 7 revisions

Introduction:

My name is Adeel Zafar. I'm a sophomore computer science student. I've been selected for GSOC'19. In this wiki, I'm going to document my whole journey from Day 1 till the end.


Project:

Create a Kiwix hotspot application that would be an extension to the kiwix android application. It would allow the users to share their ZIM Files with others over the same network. This can be made possible by:

  • Creating a layout for the user to select the files he wishes to host.
  • Working with a web server i.e. kiwix-serve. We can communicate with it via JNI(Java Native Interface).
  • Working with WIFI hotspot(without using data).
  • Presenting the IP address where the files have been hosted.
  • Some networking tricks to polish the application.

Other devices can access the ZIM files by just connecting to the hotspot and simply entering the ip address into their browser.

This project would be really beneficial in areas especially where internet is not so easily available/accessible. For example, a teacher who has the kiwix android application would be able to share the ZIM files with all the students offline.


Community Bonding Period:

It all started with community bonding period. During this, I tried to explore and research more on the project I was going to work this summer. Explored other similar projects and read documentation of the things I was going to work on. During this period, I also started communicating with my mentors and set up my development environment.


Phase 1:

This is where the coding begins. During Phase 1, I had two deliverables i.e. wifi hotspot and a demo server.


Week 1:

  • Started working on a demo application called WifiHotspotAndroid for the functionality of wifi-hotspot.
  • Implemented this feature in my branchof the kiwix-android.
  • Worked with WifiManager and WifiConfiguration classes to successfully turn on this feature but it turned out that it wasn't working with devices>=Oreo.
  • Wrote a workaround using startLocalOnlyHotspot and LocationSettings for devices>=Oreo.
  • Fixed many bugs related to wifi-hotspot.

At this point, the wifi hotspot feature functionality has been achieved.


Week 2:

Now, I had to work on a demo http server hosted on wifi hotspot to check if this project is a possibility or not.

  • Explored libraries like NanoHttpd that allow you to host an http server using your android device.
  • Explored similar android apps but none was hosting the server on wifi-hotspot. I had to find a solution that'd work for our use-case and host the server on the wireless access point i.e. wifi-hotspot.
  • Edited a demo app AndroidWebServer which uses NanoHTTPD according to our use-case i.e. hosting server on the wifi-hotspot. Here's the branch.
  • Worked on uploading hard-coded files on the server.
  • Worked on uploading user-input files on the server. Here's that branch.
  • Created a new demo app called Spotserve and copied all the working code from previous branches that was relevant to our use-case.

At this point, we have successfully figured out that,

  • We can host a web server using our android device's wifi-hotspot i.e. wireless access point.
  • Other devices can access the server by connecting to our device's hotspot.

Week 3:

  • In week 3, I did research on a number of things related to the project
  • Explored kiwix-serve, tried to understand it's codebase and how it works.
  • Explored kiwix-lib and how the JNI classes are integrated.
  • Looked into issue#138 and how it could be solved.
  • I also had semester final exams during this week so gave project a little lesser time during this period.

Week 4:

  • In week 4, I researched on how we can add a hostname to our wifi hotspot ip address and how to resolve it on client devices.
  • Compared and looked at different solutions that were implemented in windows using DNS Forwarding and setting up a local dns server, on Linux,on android using Avahi local and Zeroconf with help of patches.
  • Tried working with different android apps that work with DNS servers to look for our use-case.
  • Came to a conclusion that we can't proceed with DNS on Android due to no resource available in the Android's SDK and also negligible resources related to our use-case ever implemented in android.

Week 5:

  • In week 5, I started observing other android apps with wifi hotspot feature that how we can improve our app.
  • Implemented a Foreground service for the hotspot.
  • Added Hotspot service that will be used to run the hotspot and the foreground notification will not be dismissable unless hotspot is turned off.
  • Built foreground notification for both v O.
  • Fixed a number of bugs related to wifi hotspot.

Week 6:

  • Worked on "Creating new wifi configuration for the hotspot" and "restoring old wifi configuration".
  • Implemented this feature for devices<API 26.
  • Worked on showing hotspot details for devices<API 26.
  • Fixed a number of bugs related to wifi hotspot.

Week 7:

  • Worked on making our demo server capable of displaying an HTML file.
  • Implemented the feature to host and display an HTML file in Spotserve. Here's the branch.
  • Worked on hosting the HTML page from within the ZIM File in kiwix-android app on the server.

Week 8:

  • Integrating the demo server in kiwix-android app.
  • Fixed a number of bugs in the previous code written for Spotserve for this new branch.
  • Added new features to make the process more smooth for the user i.e. custom dialog, used handlers, etc.
  • Structured all the code for webserver to make it reusable.

Week 9:

  • Completed hosting the main page of a ZIM File on the demo server within the kiwix-android app.
  • Fixed a number of bugs in the branch and refactored all code.
  • Started working again on the iadeelzafar/wifi-hotspot branch. Removed all unnecessary code related to demo-server.
  • Integrated some dummy code for starting/stopping the server.
  • Removed the feature for turning on hotspot programmatically for devices with API<26.
  • Added a custom dialog to turn on hotspot for API<26.

Week 10:

  • Implemented the new layout i.e. showing the list of ZIM files available on device and allowing the user to select those files.
  • Getting the file paths of the selected files.
  • Added my PR
  • Integrated kiwix-serve with our feature.
  • At this point, I started working on the review suggestions on my PR.

Week 11 & Week 12:

  • Fixed many bugs related to wifi-hotspot feature, ip detection, foreground notification, etc.
  • Fixed new layout.
  • Added many improvements in the code as suggested by reviewers on my PR.
  • Created PROJECT REPORT.