FormidableLabs / react-native-app-auth

React native bridge for AppAuth - an SDK for communicating with OAuth2 providers
https://commerce.nearform.com/open-source/react-native-app-auth
MIT License
2.04k stars 441 forks source link

Android killing application due to low watermark is breached and thrashing #1009

Closed vpenchev-noteris closed 3 months ago

vpenchev-noteris commented 3 months ago

Issue

Once my app in the background, while I'm doing authorization in browser app, Android kill my app. I checked the memory usage using profiler and it seems to be fine. Android OS just kill app while it's in the background, because it follows low memory killer daemon

It would be really nice, if library can manage authorization flow by opening browser in context of application, so Android OS will never kill app due to exceeding the low watermark and trashing

Environment

zibs commented 3 months ago

Hey there, sorry to hear that you're having issues. Does this happen in production or just in development?

Either way, it's best practice to use an external browser for this: https://datatracker.ietf.org/doc/html/rfc8252#section-4 and so I don't think we'd support using an in-app webview or something.

vpenchev-noteris commented 3 months ago

@zibs no worry, I found a way to make my app more optimised in memory usage and it seems to be fine now, thank you. I did a small research and indeed, opening in-app browser(webview) has many drawbacks. In case developers would like to avoid this issue - make sure, that your application memory usage is low and stable. I strongly recommend to do profiling of android app in such a case.