Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 08d5ca3

Browse files
committed
limit the components that Intent will resolve to
1 parent 7f0344b commit 08d5ca3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,12 @@ public void sendToNotificationCentre(Bundle bundle) {
304304
}
305305

306306
Intent actionIntent = new Intent();
307-
actionIntent.setAction(context.getPackageName() + "." + action);
307+
String packageName = context.getPackageName();
308+
actionIntent.setAction(packageName + "." + action);
308309
// Add "action" for later identifying which button gets pressed.
309310
bundle.putString("action", action);
310311
actionIntent.putExtra("notification", bundle);
312+
actionIntent.setPackage(packageName);
311313
PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent,
312314
PendingIntent.FLAG_UPDATE_CURRENT);
313315
notification.addAction(icon, action, pendingActionIntent);

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationRegistrationService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ protected void onHandleIntent(Intent intent) {
3131
}
3232

3333
private void sendRegistrationToken(String token) {
34-
Intent intent = new Intent(this.getPackageName() + ".RNPushNotificationRegisteredToken");
34+
String packageName = this.getPackageName();
35+
Intent intent = new Intent(packageName + ".RNPushNotificationRegisteredToken");
3536
intent.putExtra("token", token);
37+
intent.setPackage(packageName);
3638
sendBroadcast(intent);
3739
}
3840
}

0 commit comments

Comments
 (0)