Internship project: Device to Device Transfer Android App

I would like to work on this idea . I will work out my approach and share it soon

1 Like

@Shobhit_Agarwal @LN
Hello , I am Ankur Mittal a gsoc 2018 aspirant, I have 3+ years of experience as android developer.
I would like to work on project to build accessory application to collect app for transferring data from device to device.

For those considering this project, note that Commcarehq uses WiFi Direct to transfer files between devices. Commcare shares some DNA with ODK so it may be useful to look at their approach.

1 Like

I am thinking that supervisor app can also be integrated will collect.
Introducing different modes in collect :

  1. Enumerator
  2. Supervisor
  3. Independent collector (Current working of collect app).
    Reason:
  4. Most part of the code will common for both enumerator and supervisor.
  5. Everything will be at one place
  6. Changes in Javarosa and Collect can be handled efficiently.
  7. Reduce the overhead to manage multiple apps.

@Shobhit_Agarwal @LN What are your thoughts about it?

1 Like

Great to see your brainstorming, @Akshay_Patel!

I agree the functionality could either be in a separate app or directly in Collect. The CommCare example of direct integration is a very interesting one, thanks for sharing, @Ronald_Munjoma! From what I understand, their model focuses on the "supervisor sends completed forms" use case and forms can't be modified by the recipient. Is that right?

The advantage of a separate app is that it make experimentation somewhat easier. As @Akshay_Patel points out though, building the functionality into Collect would make it easier to use. Because Collect is mission-critical for a lot of organizations, the changes to it would have to be tightly scoped and not affect how it works for most people. I would not advise trying to introduce new modes, for example.

I would encourage anyone considering this project to think about building it up iteratively. What's the smallest and simplest bit of useful functionality? For example, sending a blank form from one device to another would be quite useful in a disconnected environment. What would that functionality look like in Collect? In a separate app? That would be a great first, shippable milestone. What other such milestones could you come up with?

3 Likes

I have started experimenting with Wifi Direct.
You can see the code here :

Link for wifi direct google group:
https://groups.google.com/forum/#!forum/wi-fi-direct

What did I learned by doing this?
Wifi direct is API for android is not easy to use.
There are lot of discsussions online about issues with wifi direct.
I would personally refrain from using something that is not yet proven to be reliable.
I don't want to put Wifi direct in bad light but this is what I experienced.

Previous discussion

@adam.butler Can share more details about wifi direct POC?
Was there any connectivity issue between devices (devices getting disconnected)?

Making the connection in the first place was pretty hard, and yes, we had problems with occasionally dropping connections.

Hi everyone,
My name is Vrushabh Jambhulkar. I have experience in building Applications for mobile, as well as familiarity with drafting computer applications. I have developed more than 15 Apps in the past 3 years out of which 5 were full-stack developments, & were done solely by me.
I would like to join you for this developing project as a part of GSoC'18. This project looks very intriguing and would surely be a great experience developing it.
My github username is vrjgamer.

After reading all the chats here it seems like Wifi Direct has some issues with connectivity.
@adam.butler at the end, you switched to bluetooth for your project.
As far as i know, data transfer using wifi direct will be way faster than bluetooth.

@LN @Shobhit_Agarwal @Akshay_Patel @adam.butler So how about combining both the technologies bluetooth and wifi direct? What if we use bluetooth for connection maintenance and wifi direct for data transfer?

I have updated the wireframes and description.

https://docs.google.com/document/d/1gV3XMHGrLR4SnHqq3LnZN8YkSgXomtckpygaxqQCwjg/edit

1 Like

Thanks @vrjgamer, that's a good question. You're right of course that Wifi is faster than Bluetooth, but in my experience, bluetooth is "good enough". IMHO the advantages of shaving milliseconds off the transfer time are outweighed by the disadvantages of implementing and maintaining the extra complexity, as well as handling the UX required by increasing the potential points of failure.

1 Like

I completely agree, transfer speed should not be a significant consideration.

I'll admit it has been a while since I've tried to build on top of Bluetooth (pre Bluetooth 4!). It used to be that the pairing process was painful and unreliable but @Akshay_Patel, @dexter21 and @adam.butler, your recent experiences seem to suggest otherwise. I would say ease of discovery and pairing is critically important for this feature.

Ultimately, it will be up to internship applicants to make a compelling case for the technology they wish to use and/or include some time for technology selection in the project timeline. The proposals should make it clear what criteria they find important for selecting an underlying technology to build on. The project timeline should include time for making sure discovering, pairing and transfer are robust and strategies for verifying that they are.

For those interested in this project, I highly recommend starting to think through not just the final state of the feature but also how you would build it up incrementally and verify that it is robust.

4 Likes

Pairing, or discovery, is still pretty painful, in my experience. That's why we ended up using NFC (Near Field Communication) for that part. But I'm excited to see what other people come up with!

2 Likes

Hey is there any possibility of using blockchain so that the form data remains secured and integrated across P2P network in collect app ?

I just came across an interesting project building on top of ODK Survey called EpiSample that provides the ability to transfer files via WiFi direct (Google Play, Github). I've tried discovery and pairing between three very different devices and it works really well so it's evidence that it is possible! If you'd like to try this for yourself, one of the devices needs to be set as the team lead device in Admin Settings > Device belongs to team lead.

Some of you may be interested in studying some of the approaches there. The code is Apache 2 licensed so parts of it could even be cited and used.

3 Likes

I think wifi direct is perfect choice now for this project.

@ln Thanks for sharing the links.
The app works well. I didn't face any connection drop issue.
But, there are a couple of points that I would like to share.

  1. It wasn't mentioned anywhere about setting one of the devices as lead. If you hadn't mentioned it, it would have been difficult for me to use it. Correct me if I am wrong, it hasn't been mentioned about this setting in README(there is no README). Nor does description on play store mentions it. My point is that, for such applications, the user interface for establishing connection should be kept as simple as possible.
  2. App uses a socket connection to communicate with the other app. The port number has been hardcoded. See here.
    This is what should be avoided in Supervisor app. One of the possible ways to do it is using Local Service Discovery. See here.

I tried out transferring forms using wifi.
Here is the link to the code.

I have used QRCode as a method to share connection information to connect the two devices.
One of the devices acts a Client and other as a Server.

Server creates a hotspot and accepts Socket connection.
The same device creates QRCode with the following information:

  1. SSID of network
  2. Password (will be used if the network is password protected)
  3. Server IP
  4. Port number (Port number is NOT hardcoded)

The other device(Client) scans the QR Code.
Connects to the hotspot.
Establishes a socket connection with other devices.

Main advantages of using QR Code is :
Connection establishment becomes very easy from the user point of view.
The user need not be aware of technical details. This will be a very big advantage. I shall share usefulness of QRCode in another post.

The app uses Content Provider to access form instances.
All the received forms are stored in /odk/instances/ folder.

Other than QRCode, I had used Network Service Discovery as a method for devices to discover each other. But, for NSD to work, it requires two devices running the same app instance on the same Local network. NSD is useless if two devices aren't connected to same Acess point. That means NSD will be helpful only to establish Socket connection and not Wifi connection. So, I think NSD is of little use here.

@LN @Shobhit_Agarwal Now, the connection over wifi is easy to establish and I have transferred forms along with associated files, can it be considered as a way to achieve peer to peer sync? (Although technically it is not a peer to peer connection)

1 Like

Just to keep everything in one place and accessible to everyone, here is the link to the app that uses Bluetooth for transferring forms using Content Provider.

It uses BluetoothSocket to transfer data using InputSteam and OutputStream.
All the logic for transfer remains the same irrespective of the use of Bluetooth/ wifi direct/ wifi.

1 Like