Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Incorrect CurrentActivity value after activities are destroyed and restored by the system #45

Open
TimofeyBurak opened this issue Aug 16, 2021 · 2 comments

Comments

@TimofeyBurak
Copy link

Bug Information

Version Number of Plugin: 2.1.0.4
Device Tested On: Google Pixel 4 with Android 10.0
Simulator Tested On: none
Version of Rider: 2021.2
Version of Xamarin.Android: 11.3.0.4
Versions of other things you are using:

Steps to reproduce the Behavior

In our application we have two activities, DialogActivity is opened on top of MainActivity. We use Settings -> Developer Options -> Don't Keep Activities turned ON to simulate system high load. While top activity (DialogActivity) is opened - minimize the app and then open it again.

Expected Behavior

CrossCurrentActivity.Current.CurrentActivity should return instance of DialogActivity

Actual Behavior

CrossCurrentActivity.Current.CurrentActivity returns instance of MainActivity

Code snippet

Code: https://gist.github.com/TimofeyBurak/1c1924d45b5bd0a1aa82dcdf0ee908fe
Logs: https://gist.github.com/TimofeyBurak/6bd989e49f421d8a84fe818e9ff9741c
Looks like issue happens because paused activity also saved as current activity, which may override already resumed activity.

@Axemasta
Copy link

Axemasta commented Sep 2, 2022

Do you see this behaviour with Xamarin.Essentials? This project is no longer maintained as James moved this behaviour into Essentials, You're better off removing this package and trying with XE 😄

@TimofeyBurak
Copy link
Author

Actually, we already did switch to XE)
But it seems like XE has exactly the same implementation, at least in regards of updating current activity in OnActivityPaused(). I guess I need to double check the behaviour of XE and create an issue there, if needed.

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants