-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new method to determine if app is in foreground #7418
Comments
Interesting. I'm not sure how converting to the a lifecycle-based solution would be possible while still supporting these features / requirements: 1- allow configuration of unrelated activities as background activities: #5235 There are some side requirements for a good implementation of lifecycle aware components like "don't leak contexts" and for react-native apps like "we cannot extend the Application easily" - meaning it is difficult to get control during the lifecycle in order to attach a listener or detach a listener As a rough guess at a modern implementation, if you just do a state check like this https://stackoverflow.com/a/52678290/9910298 then you may be able to get the state similar to the current implementation without worrying about attaching/detaching listeners but you won't be able to support background activity ignore as in PR 5235 linked above It may be that All in all - not sure what the implementation that meets all the requirements + existing functionality should be here and it will require a fair bit of testing. I'm open to a PR if you want to take it on |
I just finished reading up all the available android developer docs. However! I could of course be wrong. I still would be happy to accept a PR that swaps the current implementation for one of the modern lifecycle style APIs but it would need to handle the constraints of being implemented in a non-Application extending / non-Activity-owning react-native context, and would need to implement ignore of a list of activities + work across multiple app processes as I think that's current behavior |
Hey @mikehardy I saw this fix in another library we use and that is also trying to determine if the app is in foreground. Would this type of fix be possible? https://github.com/invertase/notifee/blob/f78a56518b1fe0dab060e96c2a1f145e41b7363a/packages/react-native/android/src/main/java/io/invertase/notifee/NotifeeReactUtils.java#L201 |
@mikehardy Just wanted to circle back and see what you think of that suggestion/if it would work here |
Very interesting - I'm involved in that repo as well but haven't been active there for a while. Generally the stuff in there does work though...I may have misunderstood something about how ProcessLifecycleOwner worked, and whether we can use it effectively. It appears it is possible, I'll investigate but - with apologies - it won't be super high priority. In that sense if this is something you are interested in I'd be more than happy to take any reasonable PR |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Per android developer guide this function should only be used for debugging and apps in the past have been rejected from the google play store when included.
react-native-firebase/packages/app/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.java
Line 127 in 63f1893
The text was updated successfully, but these errors were encountered: