From 7200dabfb24acee65386144f308c438c3e8da951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Jim=C3=A9nez=20Torres?= Date: Sun, 4 Jan 2026 15:24:07 +0100 Subject: [PATCH] feat(android): open app when tapping foreground service notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../com/clawdbot/android/NodeForegroundService.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/android/app/src/main/java/com/clawdbot/android/NodeForegroundService.kt b/apps/android/app/src/main/java/com/clawdbot/android/NodeForegroundService.kt index 3c200ec2d..8f5001199 100644 --- a/apps/android/app/src/main/java/com/clawdbot/android/NodeForegroundService.kt +++ b/apps/android/app/src/main/java/com/clawdbot/android/NodeForegroundService.kt @@ -98,14 +98,25 @@ class NodeForegroundService : Service() { } private fun buildNotification(title: String, text: String): Notification { + val launchIntent = Intent(this, MainActivity::class.java).apply { + flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP + } + val launchPending = PendingIntent.getActivity( + this, 1, launchIntent, + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + ) + val stopIntent = Intent(this, NodeForegroundService::class.java).setAction(ACTION_STOP) - val flags = PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE - val stopPending = PendingIntent.getService(this, 2, stopIntent, flags) + val stopPending = PendingIntent.getService( + this, 2, stopIntent, + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + ) return NotificationCompat.Builder(this, CHANNEL_ID) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(title) .setContentText(text) + .setContentIntent(launchPending) .setOngoing(true) .setOnlyAlertOnce(true) .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)