-
-
Notifications
You must be signed in to change notification settings - Fork 461
Closed
Description
Description
Instead of checking for process foreground like we did earlier
Line 136 in d43311a
| instance.appLaunchedInForeground = ContextUtils.isForegroundImportance(); |
we could use a similar approach as firebase.
In simplified terms this would looks like the following:
final AtomicBoolean anyActivityCreated = new AtomicBoolean(false);
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacksAdapter() {
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
super.onActivityCreated(activity, savedInstanceState);
anyActivityCreated.set(true);
unregisterActivityLifecycleCallbacks(this);
}
});
new Handler(Looper.getMainLooper()).post(() -> {
final boolean isForegroundAppLaunch = anyActivityCreated.get();
Log.e(TAG, "onCreate: isForegroundAppLaunch: " + isForegroundAppLaunch);
});Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Done