capacitor-background-runner icon indicating copy to clipboard operation
capacitor-background-runner copied to clipboard

Android receives the notification but does not open the APP when tap at the notification

Open mafbasha opened this issue 2 years ago • 4 comments

Only on Android, the device receives the notification but does not open the application when tapping on the notification. On ios the behavior is as expected

scheduleDate.setSeconds(scheduleDate.getSeconds() + 20);
CapacitorNotifications.schedule([
  {
    id: 100,
    title: "Enterprise Background Runner",
    body: "Received silent push notification",
    scheduleAt: scheduleDate,
  },
]);
resolve();

mafbasha avatar Sep 29 '23 10:09 mafbasha

I'm also having this problem. I'm using version 1.0.6-dev-20240628T145630.0 (as that has fixes for Capacitor 6) I wondered if there had been any progress? It seems like a fairly obvious requirement that tapping the notification should open the app so I wondered if this has ever worked or if there's something obvious I'm missing? Thanks.

strttn avatar Aug 28 '24 10:08 strttn

Apparently the plugin doesn't make use of actionTypeId in android.

I have been able to make clicking the notification opens the app by modifying native plugin android code.

This might not be the most correct way, I am not an Android dev so not sure :)

val channelId = it.channelId ?: defaultNotificationChannelID
val intent = context.packageManager.getLaunchIntentForPackage(context.packageName)
intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
val builder = NotificationCompat.Builder(context, channelId)
builder.setContentIntent(pendingIntent)

yshalsager avatar Sep 03 '24 16:09 yshalsager

I'm also facing this issue with Version 2.0.0, is there any update? Also the App-Icon is not Appearing - just an Info Icon.

FloSojer avatar Oct 24 '24 10:10 FloSojer

Still facing the same issue on v2.1.0

hahagu avatar Jan 24 '25 10:01 hahagu