GSoC 2018: Share, a device-to-device form transfer app

gsoc-2018

(Lakshya Gupta) #1

This summer was very special for me, getting selected for GSoC for the first time and the organization being Open Data Kit (ODK) made it more valuable. I’ve started contributing to ODK in 2017 and working with ODK was my first experience with Open Source.

For me last three-four months were awesome and I learned a lot during this period. I’m writing this post as part of a final submission. This includes all the mistakes, experiments, and learnings that I did in the past three months.

Project: Device to Device Transfer Android Application

Abstract
The aim of this project is to create an Android application (addon to ODK Collect) which helps different enumerators to share the blank and filled forms and also to help supervisors in reviewing the forms sent by the enumerators.

Links
Release can be found at this link.
The repository can found at this link.

Description
The project offers features like

  • Sharing forms filled in ODK Collect between two devices,
  • Selecting forms from the app to allow a supervisor to review the forms and giving some feedback by marking the form as Accepted or Rejected and then can send back to the enumerator who asked for the review.
  • A statistics screen is also added so that it can help the supervisor in keeping track of review activity.

The project uses Wifi-Hotspot as a communication method to share forms and its resources. One needs to install ODK Collect to use the ‘Share’ app.

Goals accomplished during GSoC period

  • Set up new project in Android studio and integrated CircleCI so that only green builds can be pushed.
  • Design UI similar to ODK Collect
  • Add functionality to communicate files from one device to another
  • Added functionality to review the forms

Contributions

  • Wifi hotspot Implementation (#4, #5, #6)
  • Screen to show instances filled in ODK Collect (#10, #16)
  • Socket Connection (#11, #23)
  • Nearby Wifi networks (#17,#18)
  • Problem connecting to hotspot in Android 7 (#19, #20)
  • QR code (#21, #25)
  • Home screen to show all forms available (#32, #35)
  • Wifi Hotspot issues in Oreo (#33, #40)
  • Option to see downloaded Instances (#24, #41)
  • Add entry for downloaded forms (#26, #28)
  • Add search and sort (#36, #56)
  • Tabs screen for showing stats, sent, receive, reviewed (#37, #38)
  • Review functionality (#39, #41)
  • Setting up CircleCI (#2, #3)
  • Butterknife added (#7, #9)
  • Timber added (#8, #14)
  • Settings for hotspot configuration (#12, #22)
  • Added blank list messages(#42, #43)
  • Openings forms in collect (#44, #45)
  • Show feedback when hotspot configuration fails (#48, #51,#54, #68)
  • After being in receiving mode wifi is disabled in settings (#53, #55)
  • Receiver hangs on Connecting to wifi (#57, #62)
  • Add content to statistics screen (#63,#64)
  • SQLConnectionLeak (#66, #67)
  • Blank message modified (#70, #73)
  • Add Licenses of libraries used (#76, #77)
  • Dialog added to notify user before disabling the hotspot (#72, #75)
  • Adding unique identifier to identify who sent the form for review(#81, #82)

Still in progress

  • Provide summary on landing page (#71, #74)

Future Work

  • Currently the app is tested on Android 7.0, 7.1 and 8.0, need to test and make it work on all the versions available. Also, as we know now Android 9.0 (Pie) is launched and it has a lot of changes in WifiManager class and Share app uses wifi to connect to the hotspot, this may require more attention in the future.
  • Writing Unit and instrumentations tests.
  • Add Splash Screen and tooltips to guide users on the first interaction with the app.
  • Add some graphics to Statistics screen.

Challenges Faced:
The biggest challenge for me was to choose the communication technology which can be used for communicating the forms because Android devices have Wifi Direct, Wifi Hotspot, and Bluetooth and choosing one out of these was very difficult because each one of them has some pros and cons, I tried each one of these and came to the conclusion to use Wifi Hotspot on the basis of the reliability and speed. There were some connection drop issues with Wifi-Direct and in case of Bluetooth limitation was that two devices should be in a range of 10m and the connection is very slow compared to Wifi-Hotspot transmission. Among all the three methods wifi-hotspot is a good option to have but I had to put some extra effort to support different versions of Android. One thing that wasn’t reached this summer is adding some of the functionality directly to ODK Collect because it will require a lot of changes in the existing codebase and before integrating anything to ODK Collect I need to be sure that first, it gets in a stable state.

Also, the challenges that I faced while working on the project is to maintain good code quality, writing comments wherever necessary so that in future other contributors don’t find it difficult to contribute.

Lessons learned
I get to know about the few Android libraries like Dagger, RxJava, Timber, Butterknife and leak canary. Also, mentors helped me in improving my technical skills not only related to Android Framework but also other software engineering skills.

  • Feedback provided by the community helped me in building up the ideas of the project. Apart from all the technical skills, there are few more things which I learned while progressing through the project which I would be following in future also.
  • Make sure you communicate your ideas to the community this will help you in building up your ideas.
  • Make sure you add all the necessary information related to Git Issue or the PR so that in future it will help other fellow developers to take that issue easily.
  • Always do your research before implementing any feature, during proposal time I choose Wifi-Hotspot technology as the communication method for file transfer which I tested on only two versions, later I faced a lot of issues because the implementation worked for only a few devices. Thus it's important to do the research before going for anything.

Conclusion
I would like to thank my mentor @Shobhit_Agarwal for guiding me throughout each step of the project. He’s been really encouraging and thoughtful. His constant support helped me in accomplishing the tasks. Special thanks to @LN and @yanokwa for trusting and guiding me since my first day of ODK. Interacting with various people in the community was overwhelming. It was a wonderful experience with lots of learning experience and this is not the end, this project introduces so much possibility of adding new features which I would explore more and continue contributing.


ODK 1 TSC Call - 2018-08-22
(Hélène Martin) #2

:tada: :tada: So cool to see a first release of Share, @dexter21! Congratulations on getting it shipped and on everything you have learned this summer.

I'm hoping users like @aurdipas who have a need for this functionality will try it out and provide feedback on how it works with their devices and whether it will work well for them.

It's been really inspiring to see you and @Shobhit_Agarwal develop a great working relationship. Thanks to both of you for your hard work this summer. :sun_with_face:


(Yaw Anokwa) #3

Thanks for all your work on this project, @dexter21! I'm thrilled to see the first release of this out and looking forward to seeing you iterate on it as you have time.

Can you tell me a little bit more about the pros and cons of Wi-Fi hotspots vs Wi-Fi direct? In your initial proposal, you had tested Wi-Fi direct and found it lacking because some devices could not find each other. And from this report, it sounds like there may have been connection drop issues as well.

Given what you know now about the various patches you had to add to get hotspots working, do you still think Wi-Fi hotspot is still the best choice?


(Aurelio) #4

Hi @LN,
happy to see that things move faster then expected :slight_smile:
End of May I connected @yanokwa with a group of volunteers from Rwanda,Kenya and Tanzania willing to try out the functionality.
Paricularly from Tanzania @dicksonsamwel is one of them.
Maybe he could give us a first feedback if he's willing to give a try to the functionality :smiley:


(Lakshya Gupta) #5

looking forward to seeing you iterate on it as you have time.

Definitely

pros and cons of Wi-Fi hotspots vs Wi-Fi direct?

Initially, I tried both of the methods on two devices which I had, then hotspot worked better on those devices. And when I tried Wifi-Direct I noticed some connection drop issues. I've explored Wifi-Hotspot in much more detail than Wifi-Direct. During the exploration of the wifi-hotspot connection, I had to support each Android version differently, so a user may find the different behavior of making a connection on different devices. Now Android P is available into the market, in which I've noticed that they have deprecated some of the methods of WifiManager class, which we're using in our code, due to which some of the things may get affected.

They have also changed some of the classes and methods of WifiP2PManager class which is used for Wifi-Direct, so I think both of these communication technologies have some limitations. So we can't stick to only one communication technology.

Given what you know now about the various patches you had to add to get hotspots working, do you still think Wi-Fi hotspot is still the best choice?

Yes, I still prefer Wifi-Hotspot because of the connection reliability and speed. I agree user have to do some extra effort to trigger it on Android 7 but I think its okay.


(Yaw Anokwa) #6

@dexter21 Can you humor me a bit and try https://play.google.com/store/apps/details?id=com.majedev.superbeam on your two devices and see if they work for you? I'm asking because I'd like to understand if the problem is your specific devices or if there is something fundamental about the technology. SuperBeam seems to have a ton of reviews.


(Lakshya Gupta) #7

@yanokwa I tried the app on Android 4.4 and 7.1. When they're connected to same WiFi network they're able to communicate fine without any issues. But when they're not connected to any WiFi, then there is a problem in receiving the files, sometime it works sometime not. Previously when I tried WiFi-Direct implementation I used Android 6.0 and 7.1


(Adam Butler) #8

Fantastic work @dexter21! This is a huge addition to ODK: in-the-field sharing and approval is a potentially transformative set of features that open up a whole load of new possibilities for data collection workflows.

I only wish that eHealth Africa could have used this for a project in the Democratic Republic of Congo in 2016...


(Tom Smyth) #9

Really cool work @dexter21!


(Ukang'a Dickson) #10

Awesome work @dexter21!

Is this work released with an opensource license?

In two way sync, Alice sends to Bob then Bob sends to Alice, should duplicates be acceptable or should steps be taken to prevent Bob from receiving the same files that they had initially sent to Alice?


(Lakshya Gupta) #11

Thanks @Ukang_a_Dickson

Yes steps are taken to prevent the receiving of same forms, but when someone sends the form and it already exists on device then it replaces the form contents with the new one received because there may be a case that someone modified the form and want to share the modified version.


(Lakshya Gupta) #12

Another point release is out, you can find it out at https://github.com/opendatakit/share/releases/tag/v0.9.1, it has some bug fixes.
Please try it out and share your views about it and if looking for any other features that you want that this app should have then please write down about it in comments section.

Thanks