Technology and architecture
ShareMe: a file that stays between two phones
ShareMe is for the moment when two Android phones are already next to each other and a file still has nowhere simple to go. Uploading a video sends it out of the room. A Bluetooth list asks you to find the right name and confirm a PIN. ShareMe takes the third path: touch the top edges together, and the file moves on a link between those two phones. The app runs on Android 10 and later. Wi-Fi Aware is used when the phone has it.
What the app is for
Three aims shaped every later choice. The screen says the first one in plain words: choose the files, then touch this phone's top edge to the other phone.
Point with a gesture
The other phone is the one you touch, not a name in a list. If a physical tap is awkward, a flick or an on-screen action can stand in, with a wider window of time.
Keep the file in the room
The bytes go from one phone to the other. There is no account and no cloud copy. The file stays hidden in the gallery folder until the person chooses Keep.
Be fast, sealed, and able to continue
A large video should cross on a direct radio link. The link is encrypted, both screens show the same four-digit code, and a broken connection continues from the last byte.
How the design came together
The product grew by closing one hole at a time. A friendly gesture is not yet a safe meeting, a meeting is not yet a fast radio, and a fast radio is not yet a file you can trust.
-
A list is the wrong way to point
Two phones already in reach do not need a scan of the room. Pairing became a knock of the top edges. That is the whole invitation: the phone you are touching is the phone that receives.
-
A knock is easy to confuse with a tremor
Each phone reads the accelerometer about 400 to 500 times a second and subtracts a 50 millisecond average, so gravity and a slow tilt fall away. A hit counts when the peak change is at least 9 m/s², at least half of that energy runs along the long axis, and 500 milliseconds have passed since the previous hit. A light touch, a sideways bump, and the ring of the same impact are dropped.
A knock on the top edge travels along the long axis of the phone top edge -
One phone's knock is not a meeting
The phones do not share a clock. Each reports how long ago its own knock was, and the other places that moment on its own clock. Two physical knocks match inside 180 milliseconds. A flick or an on-screen action uses 700 milliseconds. A knock older than 880 milliseconds is forgotten. At about one accidental shock per thousand seconds, the chance that two unrelated phones both qualify during a 10 second look is about 1 in 138,000. That estimates an accident. It does not describe someone who is trying to join.
-
The file needed a radio with no router in the middle
ShareMe tries Wi-Fi Aware first and waits up to 8 seconds. The phones then talk on 5 GHz directly. If the phone has no Wi-Fi Aware, it looks for the other phone on the local network with mDNS. That second path sends the file to the access point and out again.
-
A fast radio is wasted if the file is copied twice
The sender reads 256 KB pieces, keeps up to eight of them queued, and updates a SHA-256 digest on that same read. The receiver writes straight into Pictures/ShareMe or Movies/ShareMe while MediaStore marks the item pending. Keep clears that flag with one row update. Decline deletes the file. A 4 GB video is written once.
-
Open air can be overheard
Each phone makes a one-time key pair on the P-256 curve. Before either public key is shown, its owner sends a SHA-256 commitment to that key. The keys are then opened and checked. Session keys come from the shared secret with HKDF-SHA256, and both screens show the same four-digit code. Someone between the phones has one guess: a match by chance is 1 in 10,000, and the two screens make that guess visible. The file frames use AES-GCM.
-
People step apart
If the phones leave range mid-file, the receiver keeps the bytes already written. On the new link an HMAC tied to the session, the direction, and both nonces proves it is the same transfer. Sending continues from the saved offset, and the digest from the send is still compared with the finished file.
One transfer, from the tap to the gallery
The same path, drawn as the sequence a person actually sees.
- Choose the files
- The phones find each other
- The top edges meet
- Both knocks fall in one window
- The same four-digit code appears
- The file moves in 256 KB pieces
- It lands hidden in the gallery folder
- Keep publishes it, or a drop resumes from the last byte
What the radios measured
On a clear channel the direct Wi-Fi Aware link in this project measured about 94 MB/s. With the home Wi-Fi radio also on, the same direct link measured about 57 MB/s. Through a home access point and a mesh repeater the measurement was about 1.2 MB/s, because the file crosses the air twice. The bars use one scale, from 0 to 100 MB/s. They describe these measurements, not every phone and every room.
- Direct Wi-Fi Aware, clear channel 94 MB/s
- Direct Wi-Fi Aware, home Wi-Fi also on 57 MB/s
- Home Wi-Fi through a mesh repeater 1.2 MB/s
Technologies on that path
The app is Kotlin. The screen is Jetpack Compose with Material 3. Work away from the screen runs in coroutines, behind a ViewModel. The diagram is the same path, named by the piece that does the job.
- ScreenJetpack Compose and Material 3. Choose files, read the code, keep or decline.
- GestureAccelerometer, about 400–500 Hz, with a flick or an on-screen action as a fallback.
- MeetingEach phone's own clock. Two physical knocks inside 180 milliseconds.
- LinkWi-Fi Aware first, for up to 8 seconds. Then NSD and mDNS on the local network. TCP carries the bytes.
- SealECDH on P-256, a SHA-256 commitment, HKDF-SHA256, a four-digit code, AES-GCM on each frame.
- FileA pipeline of 256 KB pieces, SHA-256 on the same read, MediaStore with a pending flag, HMAC to resume.