Skip to content

Fix Android foreground geolocation update distance - #35783

Merged
kubaflo merged 4 commits into
inflight/currentfrom
jfversluis/fix-geolocation-listening-distance
Jun 5, 2026
Merged

Fix Android foreground geolocation update distance#35783
kubaflo merged 4 commits into
inflight/currentfrom
jfversluis/fix-geolocation-listening-distance

Conversation

@jfversluis

@jfversluis jfversluis commented Jun 5, 2026

Copy link
Copy Markdown
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Stops Android foreground geolocation listening from using the desired accuracy distance as the platform minimum movement threshold. MinimumTime now controls the requested update cadence without imposing a hidden 50m+ distance gate for GeolocationAccuracy.Best.

The existing accuracy value is still used by the listener to filter out locations that do not satisfy the requested accuracy.

Issues Fixed

Fixes #22683

Validation

  • Built src/Essentials/src/Essentials.csproj for net10.0-android36.0.

Manual regression coverage

Automated Android device coverage for this exact regression would require controlling mock location updates from the test app/device environment, which is not reliable in the current Essentials device-test setup. Please validate the PR artifacts with the issue repro or Essentials geolocation sample:

  1. Install this PR's artifacts using the dogfood instructions above.
  2. Start foreground listening with new GeolocationListeningRequest(GeolocationAccuracy.Best, TimeSpan.FromSeconds(1)).
  3. Keep the app in the foreground and send or perform multiple location changes that remain within 50 meters of the previous position.
  4. Confirm LocationChanged continues firing for those sub-50m updates instead of stopping after the initial GPS/network callbacks.
  5. Confirm updates still include high-accuracy locations; locations whose reported accuracy is worse than the requested accuracy can still be filtered by the existing listener accuracy check.

PureWeen and others added 4 commits June 2, 2026 16:26
… it) (#35714)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Follow-up to @kubaflo's review on #35687.

## What

In `eng/pipelines/ci-copilot.yml`, when `parameters.Platform ==
'android'`, the Android AVD was being created twice:

1. **First**, via `common/provision.yml` running the
`ProvisionAndroidSdkAvdCreateAvds` MSBuild target — because
`skipAndroidCreateAvds: ${{ ne(parameters.Platform, 'android') }}`
evaluated to `false` for Android. That target invokes `dotnet android
avd create --name "Emulator_30" … --force`.
2. **Then**, the inline `Create AVD and boot Android Emulator` script
ran `avdmanager create avd -n Emulator_30 -k
"system-images;android-30;google_apis_playstore;x86_64" --device "Nexus
5X" --force`.

Both create the same AVD name with `--force`, so the second silently
overwrites the first — no error, just ~30–60s wasted on every Copilot
review pipeline run for Android.

The inline script is the canonical source of truth: it pins the
`google_apis_playstore` image variant, the `Nexus 5X` device profile,
the `disk.dataPartition.size=2048m` shrink, and ADB key pre-auth. None
of those are applied by `ProvisionAndroidSdkAvdCreateAvds`. So the right
fix is to skip the provision step entirely and let the inline script own
AVD creation.

## Change

Pinned `skipAndroidCreateAvds: true` (with an explanatory comment) at
both call sites of `common/provision.yml` in `ci-copilot.yml` (the
ReviewPR stage and the Deep stage). The inline `avdmanager` blocks are
untouched.

This is the AVD-creation portion of #35376 being reverted — the inline
script that same PR added already handles AVD creation, so the
provision-step AVD creation was redundant.

## Scope

This change is scoped to **`ci-copilot.yml`** only — the Copilot review
pipeline. It does **not** touch the required gating pipelines:
- `maui-pr`
- `maui-pr-devicetests`
- `maui-pr-uitests`

## Follow-up

Needs to be ported to `net11.0` afterward via the automated
`merge/main-to-net11.0` flow.

Co-authored-by: bot <bot@test>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…authors (#35751)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Problem

Two issues with the daily "PR Review Queue" automation:

### 1. Workflow runs in forks and creates duplicate tracking issues

`.github/workflows/pr-review-queue.yml` had no fork guard, so the daily
scheduled run (`cron: "0 8 * * 1-5"`) was firing in active forks of
dotnet/maui as well as in upstream. The `gh issue create --repo ${{
github.repository }}` step targets the running repo, so each fork ended
up with its own `[PR Review Queue]` issue alongside the legitimate
dotnet/maui one — e.g. `PureWeen#105` and `#35732` for
the same day, both pinging the fork owner.

### 2. Every PR author gets @-mentioned daily

The markdown table emitted each PR author handle as a raw `@username`,
which GitHub parses as a real mention. Each daily run created a new
issue and notified every PR author — community contributors, partner
devs, bots — even though the issue is purely an internal MAUI-team
triage artifact.

## Changes

**`.github/workflows/pr-review-queue.yml`** — Add the same
`github.repository_owner == 'dotnet'` guard already used by 8 other
dotnet-owned workflows in this repo (`backport.yml`, `rebase.yml`,
`locker.yml`, `dogfood-comment.yml`, `maestro-changelog.yml`,
`inclusive-heat-sensor.yml`, `dotnet-format-daily.yml`,
`dotnet-autoformat-pr-push.yml`). Applied to both jobs:
  - `generate-report` — stops the scheduled issue creation on forks.
- `validate` — stops fork-internal PRs from spending CI on the dry-run.


**`.github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1`**
— Wrap author handles in backticks (`` `@username` ``) in all four
table-row formats. GitHub does not parse mentions inside code spans, so
no notifications fire, but the table still reads naturally as a list of
author handles.

## Verification

- YAML parses cleanly (`python3 -c "import yaml; yaml.safe_load(...)"`).
- PowerShell escape verified — `"``@$($pr.Author)``"` renders as ``
`@PureWeen` ``.
- Existing renderer logic for `$showMilestone` / `$showTurn` variants
left intact; only the author cell changed.

## Out of scope

Other automation in this repo was checked and is already fork-safe:
- The gh-aw `*.lock.yml` files (`agentic-labeler`, `daily-repo-status`,
`copilot-evaluate-tests`) and `agentics-maintenance.yml` are
auto-generated (`DO NOT EDIT`) and have their own pre-activation role
checks.
- `review-trigger.yml` is implicitly fork-safe via its actor-permission
check.

---------

Co-authored-by: bot <bot@test>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tartup crashes (#35724)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

PowerShell 7.4.x intermittently crashes at startup on macOS with:

```
Call to 'procargs' failed with errno 5
Unhandled exception. Microsoft.PowerShell.ManagedPSEntry+StartupException
   at Microsoft.PowerShell.ManagedPSEntry.ThrowOnFailure(String call, Int32 code)
   at Microsoft.PowerShell.ManagedPSEntry.AttemptExecPwshLogin(String[] args)
   at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)
```

This is
[PowerShell/PowerShell#20802](PowerShell/PowerShell#20802)
— open and untriaged since November 2023, **0 comments, no linked PRs,
no fix shipped**. The crash happens in `AttemptExecPwshLogin`, which on
macOS calls `sysctl(KERN_PROCARGS2)` to inspect its own `argv[0]` and
decide whether pwsh was launched as a login shell. That `sysctl` call
races intermittently and returns `errno 5`, aborting startup before pwsh
reads any user script.

## Repro / impact

Hit on the internal `dotnet-maui` pipeline (definition 1095), build
**2990586**, during release-prep for `release/11.0.1xx-preview5`:

> `##[section]Starting: Provision Android SDK - Common Packages` → `Call
to 'procargs' failed with errno 5` → task fails with exit code `null`.

A rerun on a different agent passed, but every macOS `pwsh:` /
`PowerShell@2` step in the pipeline is a flake risk going forward.
Inventory: ~57 pwsh tasks across 15 pipeline YAMLs, ~45 of them on
macOS-eligible jobs.

## Fix

PowerShell itself ships a short-circuit for this code path. From
[`src/powershell/Program.cs`](https://github.com/PowerShell/PowerShell/blob/master/src/powershell/Program.cs):

```csharp
private const string LOGIN_ENV_VAR_NAME = "__PWSH_LOGIN_CHECKED";

if (Environment.GetEnvironmentVariable(LOGIN_ENV_VAR_NAME) != null)
{
    Environment.SetEnvironmentVariable(LOGIN_ENV_VAR_NAME, null);
    return;   // ← skips the racy sysctl(KERN_PROCARGS2) entirely
}
```

Setting `__PWSH_LOGIN_CHECKED=1` makes pwsh skip the racy syscall. This
PR declares it as a pipeline-level variable in
`eng/pipelines/common/variables.yml` (included by every macOS-touching
pipeline — `ci.yml`, `ci-official.yml`, `ci-device-tests.yml`,
`ci-copilot.yml`, `ci-uitests.yml`, `device-tests.yml`, `ui-tests.yml`,
`handlers.yml`, etc.). Per [AzDO
docs](https://learn.microsoft.com/azure/devops/pipelines/process/variables),
user-defined variables are injected as environment variables for every
task — so every `pwsh:` / `PowerShell@2` step in every job inherits it.

## Safety analysis

This is safe because:

- **CI never wants login-shell semantics.** No `-Login` flag, no leading
`-` in `argv[0]`. The skipped code's `IsLogin()` check would have
returned `false` and the function would have returned without doing
anything visible. We just avoid the broken syscall that precedes that
decision.
- **The env var is single-use per process.** `AttemptExecPwshLogin`
consumes it via `SetEnvironmentVariable(LOGIN_ENV_VAR_NAME, null)`, so
nested `pwsh-launches-pwsh` scenarios still work normally (each new task
gets a fresh AzDO-injected value).
- **Windows is unaffected.** The read is inside a `#if UNIX` block;
Windows pwsh ignores the var entirely. Setting it on Windows agents is a
no-op.
- **Safe even under `-Login`.** If a future step explicitly adds
`-Login`, the short-circuit still routes around the broken syscall — the
same syscall the login-shell *detection* relies on. So there's no
regression even in that (currently nonexistent) use case.

## Empirical validation

Verified locally on `pwsh 7.4.5` / macOS 26.5 (same 7.4.x minor as the
CI agent that crashed):

| Run | Command | Result |
| --- | --- | --- |
| Control | `pwsh ... -Command 'Write-Output
"envvar=[$Env:__PWSH_LOGIN_CHECKED]"'` | `envvar=[]` (var unset; nothing
to clear) |
| Test | `__PWSH_LOGIN_CHECKED=1 pwsh ... -Command 'Write-Output
"envvar=[$Env:__PWSH_LOGIN_CHECKED]"'` | `envvar=[]` ← **proves the
short-circuit ran** (the only line that clears the var is inside the
skip-path; if it cleared, the racy syscall was never reached) |
| Soak | 100 × `__PWSH_LOGIN_CHECKED=1 pwsh ... -Command 'exit 0'` |
**0/100 failures**; no behavioral change |

## Backport plan

- This PR: `main` (.NET 10 SR dev). Drives the fix into ongoing
servicing builds.
- Will cherry-pick to `net11.0` afterward (where build 2990586 crashed
during preview5 prep). Diff is verified to apply cleanly to both
branches.

## Related macOS-agent flakes (out of scope)

The same dnceng macOS agent pool has produced other, *unrelated* flakes
during this release-prep window (e.g.
`IDEDownloadableMetalToolchainCoordinator: Failed to remount` and `iOS
26.2 platform not installed` on builds 2990581 and 2990384). Those are
agent-image issues and need agent-side fixes — they're not addressed
here. This PR fixes one specific class of macOS flake (pwsh startup
race), not all of them.

Co-authored-by: bot <bot@test>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stop using the desired accuracy distance as the Android minimum movement threshold for foreground geolocation listening. This allows MinimumTime to control update cadence without imposing a hidden 50m+ movement gate.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35783

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35783"

@github-actions github-actions Bot added area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/android labels Jun 5, 2026
@kubaflo

kubaflo commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/enhanced-reviewer

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 1 findings

See inline comments for details.


foreach (var provider in listeningProviders)
LocationManager.RequestLocationUpdates(provider, minTimeMilliseconds, providerInfo.Accuracy, continuousListener, looper);
LocationManager.RequestLocationUpdates(provider, minTimeMilliseconds, 0, continuousListener, looper);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[major] Regression Prevention — This bug fix changes Android foreground listening semantics but has no regression coverage. Please add an Android Essentials device/integration test or documented manual test coverage that proves StartListeningForegroundAsync continues raising LocationChanged when the reported position remains within the previous 50-100m accuracy-distance threshold. Without that, this can regress back to treating desired accuracy as minDistance.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added documented manual regression coverage to the PR description.

I did not add an automated Android Essentials device test for this servicing fix because proving this exact behavior would require controlling sub-50m mock location updates from the test app/device environment, and the current Essentials device-test setup does not provide a reliable mock-location path for Helix. The documented scenario validates the old failure mode directly: start foreground listening with GeolocationAccuracy.Best and a 1-second cadence, then send or perform multiple location changes within 50m and confirm LocationChanged continues firing instead of being gated by the old accuracy-distance threshold.

@MauiBot MauiBot added s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Jun 5, 2026
MauiBot

This comment was marked as outdated.

@kubaflo

kubaflo commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/enhanced-reviewer

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review Summary

@jfversluis — new AI review results are available based on this last commit: 4304990.
Fix Android geolocation foreground update distance To request a fresh review after new comments or commits, comment /review rerun.

Gate Skipped Code Review In Review Confidence Medium Platform Android

Review Sessions — click to expand
Gate — Test Before & After Fix

Gate Result: ⚠️ SKIPPED

No tests were detected in this PR.

Recommendation: Add tests to verify the fix using the write-tests-agent.


UI Tests — Essentials

Detected UI test categories: Essentials

⏭️ Deep UI tests — 0 passed, 0 failed across 1 category on platform-pool agent (replaces in-process counts above). 1 category reported 0 tests.

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
Essentials 0 tests
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

Pre-Flight — Context & Validation

Issue: #22683 - Geolocation.StartListeningForegroundAsync stopps calling event after 2 positions on Android
PR: #35783 - Fix Android foreground geolocation update distance
Platforms Affected: Android
Files Changed: 1 implementation, 0 test

Key Findings

  • Android foreground geolocation used the desired accuracy distance from GetBestProvider as LocationManager.RequestLocationUpdates minDistance, so GeolocationAccuracy.Best could impose a hidden 50m movement threshold.
  • PR #35783 changes only src/Essentials/src/Geolocation/Geolocation.android.cs, replacing the foreground-listening minDistance argument with 0 while keeping listener-side reported-accuracy filtering.
  • Gate was already skipped before this phase because no tests were detected in the PR; inline discussion requested regression coverage and the author added documented manual coverage.

Code Review Summary

Verdict: LGTM
Confidence: medium
Errors: 0 | Warnings: 0 | Suggestions: 1

Key code review findings:

  • 💡 Consider future regression coverage if Android Essentials device tests gain reliable mock-location support; no required code change for this PR.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #35783 Pass 0 as Android foreground minDistance and keep providerInfo.Accuracy as listener-side accuracy filter ⚠️ Gate SKIPPED (no tests detected) src/Essentials/src/Geolocation/Geolocation.android.cs Original PR

Code Review — Deep Analysis

Code Review — PR #35783

Independent Assessment

What this changes: Android foreground geolocation listening now calls LocationManager.RequestLocationUpdates(..., minDistance: 0, ...) instead of reusing providerInfo.Accuracy as the requested minimum movement distance.
Inferred motivation: DesiredAccuracy should filter delivered locations by reported accuracy in ContinuousLocationListener, not impose a hidden 50m/100m/250m+ movement gate that can suppress LocationChanged events despite MinimumTime requesting a cadence.

Reconciliation with PR Narrative

Author claims: The PR fixes Android foreground listening by removing the accidental distance threshold while keeping the existing accuracy filter; it fixes #22683 and documents manual validation because automated Android mock-location regression coverage is not reliable in current Essentials device tests.
Agreement/disagreement: This matches the code and linked issue. The issue reports updates stopping until larger movement occurs; the old code passed the same accuracy-distance value to Android's minDistance, so the fix addresses the inferred root cause. A prior inline review asked for regression coverage; the author added manual validation notes, and I am not duplicating that comment.

Findings

No ❌ Error findings.

No ⚠️ Warning findings.

💡 Suggestion — Consider future regression coverage if mock-location support improves

The lack of automated coverage is understandable for this servicing-sized Android platform fix, but this behavior would be worth covering if Essentials device tests later gain reliable mock location injection. No action required for this PR.

Devil's Advocate

The main risk is increased callback volume/battery use because Android no longer has a movement-distance gate. However, MinimumTime still controls cadence and this API's shared contract describes minimum time between updates plus an accuracy filter, not a movement threshold. The listener still filters location.Accuracy <= desiredAccuracy, so low-quality locations are not surfaced. CI is still pending, so this is a code-review verdict rather than a merge-readiness approval.

Verdict: LGTM

Confidence: medium
Summary: The one-line Android change is consistent with the API contract and the linked bug's symptoms, and I found no correctness issues in the changed line or its immediate consumers. CI has no failures in the data available, but several checks are still pending/in progress, so final merge should wait for completion.


Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix Separate desired accuracy from listening movement threshold with DesiredAccuracy tuple naming and GetMinimumListeningDistance() ✅ Build passed; regression test unavailable 1 file Clearer semantics, but behaviorally equivalent to PR and not better
2 try-fix Use API 31+ LocationRequest.Builder with explicit SetMinUpdateDistanceMeters(0) and executor, legacy fallback ✅ Build passed after compile iterations; regression test unavailable 1 file Meaningfully different, but larger/riskier servicing change
3 try-fix Add Android partial GeolocationListeningRequest.PlatformMinimumDistance => 0 and use it at call site ✅ Build passed; regression test unavailable 2 files Self-documenting, but extra abstraction for constant
PR PR #35783 Pass literal 0 for foreground Android minDistance; keep desired accuracy as listener filter ⚠️ Gate SKIPPED (no tests detected) 1 file Smallest correct fix

Cross-Pollination

Model Round New Ideas? Details
maui-expert-reviewer 1 Yes Proposed modern LocationRequest, semantic refactor, request helper/partial, and adaptive threshold ideas.
maui-expert-reviewer 2 Yes Proposed request-level Android partial as a distinct candidate after attempts 1-2.
maui-expert-reviewer 3 No Rejected remaining variants: adaptive threshold preserves the bug; named constants/helpers are equivalent; AndroidX/public API options are inappropriate for servicing.

Exhausted: Yes
Selected Fix: PR's fix — It is the smallest behaviorally correct change. Candidate 2 is the only materially different compiled alternative, but it adds API-level branching/executor behavior without proving better regression coverage or correctness. Candidates 1 and 3 improve naming/readability but are not demonstrably better than the PR.


Report — Final Recommendation

Comparative Fix Report — PR #35783

Candidate ranking

Rank Candidate Result Assessment
1 pr ⚠️ Gate skipped; no tests detected Smallest correct fix. Removes the accidental Android movement threshold while preserving listener-side reported-accuracy filtering.
2 pr-plus-reviewer ⚠️ Gate skipped; no tests detected Expert reviewer found no actionable code changes, so this is equivalent to pr; ranked below pr only because it adds no distinct improvement.
3 try-fix-1 ✅ Build passed; regression unavailable Behaviorally equivalent to the PR with clearer tuple/helper naming, but it changes more lines without improving correctness.
4 try-fix-3 ✅ Build passed; regression unavailable Encodes the zero threshold as an Android partial GeolocationListeningRequest.PlatformMinimumDistance, but adds an extra abstraction/file for a constant.
5 try-fix-2 ✅ Build passed after compile iterations; regression unavailable Uses modern API 31+ LocationRequest.Builder plus executor fallback. It is materially different but riskier for a servicing fix because it adds API-level branching and dispatch behavior for the same functional outcome.

No candidate had a failed regression test. The original gate was skipped because the PR contains no automated tests, and all try-fix candidates reported builds passing after their final iteration. Per the ranking rule, there were no regression-failing candidates that needed to be forced below passing candidates.

Analysis

The raw PR fix directly addresses the root cause: Android foreground listening accidentally used the desired accuracy distance as minDistance, causing LocationChanged to stop for sub-threshold movement. Passing 0 lets Android deliver updates according to MinimumTime, while ContinuousLocationListener continues filtering by reported location accuracy.

pr-plus-reviewer does not differ from pr because the expert reviewer wrote an empty inline findings array and recommended no source changes. try-fix-1 and try-fix-3 improve semantic labeling but do not provide a correctness advantage over the one-line PR. try-fix-2 modernizes newer Android request creation, but that additional complexity is not justified for this bug because the legacy overload with minDistance: 0 already expresses the intended behavior across supported Android versions.

Winner

Winner: pr

The submitted PR is the best candidate because it is the minimal behaviorally correct fix, preserves existing accuracy filtering, avoids new public API or abstraction, and avoids API-level branching risk. The only remaining gap is automated regression coverage; the PR currently relies on documented manual validation because reliable Android mock-location regression coverage was not available.


Future Action — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@kubaflo
kubaflo changed the base branch from main to inflight/current June 5, 2026 20:21
@kubaflo
kubaflo merged commit 0b40bfe into inflight/current Jun 5, 2026
29 of 38 checks passed
@kubaflo
kubaflo deleted the jfversluis/fix-geolocation-listening-distance branch June 5, 2026 20:21
@github-actions github-actions Bot added this to the .NET 10.0 SR8 milestone Jun 5, 2026
PureWeen pushed a commit that referenced this pull request Jun 11, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
@sheiksyedm sheiksyedm modified the milestones: .NET 10 SR8, .NET 10 SR9 Jun 18, 2026
PureWeen pushed a commit that referenced this pull request Jun 22, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
kubaflo pushed a commit that referenced this pull request Jun 25, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
kubaflo pushed a commit that referenced this pull request Jul 3, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
@kubaflo kubaflo mentioned this pull request Jul 6, 2026
kubaflo pushed a commit that referenced this pull request Jul 6, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
PureWeen pushed a commit that referenced this pull request Jul 7, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
PureWeen pushed a commit that referenced this pull request Jul 7, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
kubaflo pushed a commit that referenced this pull request Jul 10, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
kubaflo pushed a commit that referenced this pull request Jul 15, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Stops Android foreground geolocation listening from using the desired
accuracy distance as the platform minimum movement threshold.
`MinimumTime` now controls the requested update cadence without imposing
a hidden 50m+ distance gate for `GeolocationAccuracy.Best`.

The existing accuracy value is still used by the listener to filter out
locations that do not satisfy the requested accuracy.

### Issues Fixed

Fixes #22683

### Validation

- Built `src/Essentials/src/Essentials.csproj` for
`net10.0-android36.0`.

### Manual regression coverage

Automated Android device coverage for this exact regression would
require controlling mock location updates from the test app/device
environment, which is not reliable in the current Essentials device-test
setup. Please validate the PR artifacts with the issue repro or
Essentials geolocation sample:

1. Install this PR's artifacts using the dogfood instructions above.
2. Start foreground listening with `new
GeolocationListeningRequest(GeolocationAccuracy.Best,
TimeSpan.FromSeconds(1))`.
3. Keep the app in the foreground and send or perform multiple location
changes that remain within 50 meters of the previous position.
4. Confirm `LocationChanged` continues firing for those sub-50m updates
instead of stopping after the initial GPS/network callbacks.
5. Confirm updates still include high-accuracy locations; locations
whose reported accuracy is worse than the requested accuracy can still
be filtered by the existing listener accuracy check.

---------
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/android s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Geolocation.StartListeningForegroundAsync stopps calling event after 2 positions on Android

5 participants