Skip to content

Conversation

@ne0rrmatrix
Copy link
Member

Description of Change

This pull request improves the behavior of the foreground service notification in the MediaControlsService for Android by ensuring that tapping the notification brings the user back to the main app activity. The changes introduce a helper method to create the appropriate PendingIntent and attach it to the notification.

Enhancement to notification interaction:

  • The notification shown by MediaControlsService now includes a content intent, so tapping the notification will launch (or bring to front) the main app activity. This is achieved by creating a PendingIntent using the new CreateActivityPendingIntent() method and setting it with SetContentIntent on the notification builder.

Internal code improvements:

  • Added a static CreateActivityPendingIntent() method that safely constructs a PendingIntent to launch the main activity, handling potential null references and setting intent flags to ensure correct activity behavior.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Fixes a long standing issue where clicking on notification after leaving app does not restore app. This fixes that issue and restores expected default android behavior.

Copilot AI review requested due to automatic review settings December 1, 2025 09:03
@ne0rrmatrix ne0rrmatrix requested review from TheCodeTraveler and removed request for Copilot December 1, 2025 09:04
Copilot finished reviewing on behalf of ne0rrmatrix December 1, 2025 09:05
justcoding121 added a commit to justcoding121/bible-alarm that referenced this pull request Dec 1, 2025
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.

[BUG] Android 14+ Notification Body Tap Does Nothing

1 participant