← Blog
✎Blogbeitrag

The hotspot refusal was a permission we never granted

A small brass key on a brushed steel shelf beside a face-down black phone, in teal and steel with a warm amber light, the AMARBARO mark and wordmark centred over it.

The hotspot refusals on our Android test phone came from a start that failed on a missing Nearby Wi-Fi permission, not from the phone, and the hotspot started in 3,120 ms after a force-stop cleared the state.

On the test phone, the hotspot kept refusing. The code we logged was ERROR_INCOMPATIBLE_MODE, which we read as the phone refusing a hotspot mode. We wrote that down as the phone refusing hotspots. Our old build showed it, and so did the new one.

It was our app. The start had thrown because the app did not hold the Nearby Wi-Fi devices permission, NEARBY_WIFI_DEVICES, and what we logged was the refusal code. Force-stopping the app cleared the state. After that, ABCam, our phone-as-webcam app, started its hotspot in 3,120 ms, about three seconds. The photo server in ABSend, our file-sending app, answered 200 with 11,572 bytes on the new network.

Why we blamed the phone

The refusal code belongs to the phone's vocabulary, so it reads like the phone's decision. A missing permission is a failure in our code, but it arrives under the phone's name. That is the trap: the error is true about the mode and silent about the cause. A failed test looks like the device's fault until something in our own code shows otherwise, and in the logged path nothing did.

What we ruled out first

We turned location on and off, and Wi-Fi on and off. Neither changed the result. Both builds refused, so the merge into one codebase did not cause it. Only a force-stop cleared the refusal.

The old build was the app as it stood before the merge into one codebase. The new build is the merged app with the shared network module. Both refused in the same way, so the refusal was already there before the merge and was not something the merge introduced. That mattered for where we looked: the merge was the obvious suspect, and it was not the cause.

The permission is declared, and the app asks for it

The app's manifest declares NEARBY_WIFI_DEVICES. The connect screen then picks between that permission and ACCESS_FINE_LOCATION, the location permission, with a condition on one line. So the app does ask. What was missing was the grant at the moment the hotspot started.

The permission existing in the code was never the question. The question was whether the start ran with the grant in hand, and the log did not say.

What a working run looked like

A hotspot is the phone making its own Wi-Fi network for other devices to join. Starting one is a system action, and it can fail before any network appears at all.

On the same phone, after the force-stop, ABCam's start took 3,120 ms. ABSend's own button moved to ready, the photo server answered, and Stop removed the hotspot interface again. Each of those was a separate check, and together they are one run on one device, not a benchmark. The 3,120 ms is the wait a user would feel after tapping the button, which is why it is the number we keep.

The fix we have is a reset, not a grant

Our record shows no code change for this refusal. The force-stop resets the app's state. It does not give the app a permission. A better fix would ask for the permission before the start, so a missing grant shows up as a prompt instead of a silent failure. We have not checked whether the app does that today.

What we still do not know

  • Whether the grant was given later, or whether the force-stop only reset a stuck start. Our record shows the clearing, not the grant state.
  • Whether another Android version takes the other branch of that condition. We tested one foldable phone and did not test the location path.
  • Whether 3,120 ms holds across runs. It is one timing on one device, not a benchmark.

How to prove this wrong

Install a clean build on the same phone. Deny the permission, start the hotspot, and expect the same refusal with the same mode code. Then grant the permission without a force-stop, start again, and time it. If it still refuses with the permission in place, the permission was not the cause and this post is wrong.

Repeat on a second phone with a different Android version before anyone relies on the result.

Provenance

  • ~/Brain/AB-Android/2026-11-17-consolidation.md: the refusal in both builds, the 3,120 ms device check, the ABSend page answer, and the missing-grant finding.
  • ~/Projects/hardware/AB-Android/apps/ABSend/app/src/main/AndroidManifest.xml: the NEARBY_WIFI_DEVICES declaration.
  • ~/Projects/hardware/AB-Android/apps/ABSend/app/src/main/java/com/amarbaro/sender/ConnectActivity.kt: the permission choice on line 162.

Kommentare

Noch keine Kommentare.

Anmelden um zu kommentieren.