Skip to content

fix(android): start vpn via foreground service path#13

Merged
Hidden-Node merged 2 commits into
Hidden-Node:mainfrom
AmirrezaFarnamTaheri:codex/android-vpn-lifecycle-start
May 14, 2026
Merged

fix(android): start vpn via foreground service path#13
Hidden-Node merged 2 commits into
Hidden-Node:mainfrom
AmirrezaFarnamTaheri:codex/android-vpn-lifecycle-start

Conversation

@AmirrezaFarnamTaheri
Copy link
Copy Markdown
Contributor

  • Use ContextCompat.startForegroundService for connect requests
  • promote the VpnService immediately when handling ACTION_CONNECT, matching Android foreground-service requirements before the longer profile/core startup work begins.
  • Bound the partial wake lock to the existing long SOCKS startup window plus a small grace period so setup work is protected without holding an indefinite wake lock.

Use ContextCompat.startForegroundService for connect requests and promote the VpnService immediately when handling ACTION_CONNECT, matching Android foreground-service requirements before the longer profile/core startup work begins.

Bound the partial wake lock to the existing long SOCKS startup window plus a small grace period so setup work is protected without holding an indefinite wake lock.
Add structured Android-side logs around VPN teardown so support reports can show TUN close, DNS-aware TUN bridge stop, Go core stop, Android job cleanup, and foreground notification cleanup.

Also log that the current Android VPN route is IPv4-only, making the existing behavior explicit without changing core routing or mobile bridge behavior.
@Hidden-Node Hidden-Node merged commit 4513da4 into Hidden-Node:main May 14, 2026
2 checks passed
@Hidden-Node
Copy link
Copy Markdown
Owner

Thanks for this great contribution! The move to a foreground service and the smart Wake Lock handling are excellent improvements for the app's stability and battery life. Solid work, appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants