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

Commit 700cb44

Browse files
authored
Merge pull request #1446 from taymer/master
#1431
2 parents 2254fd4 + 821cad2 commit 700cb44

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
repo-token: ${{ secrets.GITHUB_TOKEN }}
1313
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions."
1414
stale-pr-message: "This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions."
15-
days-before-stale: 560
15+
days-before-stale: 365
1616
days-before-close: 30
1717
operations-per-run: 30

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

+45-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import com.google.firebase.iid.InstanceIdResult;
3939
import com.google.firebase.messaging.FirebaseMessaging;
4040

41-
public class RNPushNotification extends ReactContextBaseJavaModule implements ActivityEventListener {
41+
public class RNPushNotification extends ReactContextBaseJavaModule implements ActivityEventListener , Application.ActivityLifecycleCallbacks{
4242
public static final String LOG_TAG = "RNPushNotification";// all logging should use this tag
4343

4444
private RNPushNotificationHelper mRNPushNotificationHelper;
@@ -51,6 +51,7 @@ public RNPushNotification(ReactApplicationContext reactContext) {
5151
reactContext.addActivityEventListener(this);
5252

5353
Application applicationContext = (Application) reactContext.getApplicationContext();
54+
applicationContext.registerActivityLifecycleCallbacks(this);
5455

5556
// The @ReactNative methods use this
5657
mRNPushNotificationHelper = new RNPushNotificationHelper(applicationContext);
@@ -81,6 +82,8 @@ private Bundle getBundleFromIntent(Intent intent) {
8182
}
8283
return bundle;
8384
}
85+
86+
@Override
8487
public void onNewIntent(Intent intent) {
8588
Bundle bundle = this.getBundleFromIntent(intent);
8689
if (bundle != null) {
@@ -277,4 +280,45 @@ public void run() {
277280
}
278281
}).start();
279282
}
283+
284+
@Override
285+
public void onActivityCreated(Activity activity, Bundle bundle) {
286+
287+
}
288+
289+
@Override
290+
public void onActivityStarted(Activity activity) {
291+
Intent intent = activity.getIntent();
292+
Bundle bundle = this.getBundleFromIntent(intent);
293+
if (bundle != null) {
294+
bundle.putBoolean("foreground", false);
295+
intent.putExtra("notification", bundle);
296+
mJsDelivery.notifyNotification(bundle);
297+
}
298+
}
299+
300+
@Override
301+
public void onActivityResumed(Activity activity) {
302+
303+
}
304+
305+
@Override
306+
public void onActivityPaused(Activity activity) {
307+
308+
}
309+
310+
@Override
311+
public void onActivityStopped(Activity activity) {
312+
313+
}
314+
315+
@Override
316+
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
317+
318+
}
319+
320+
@Override
321+
public void onActivityDestroyed(Activity activity) {
322+
323+
}
280324
}

0 commit comments

Comments
 (0)