Saved searches
Use saved searches to filter your results more quickly
Cancel Create saved search
Sign up Reseting focus
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
This repository has been archived by the owner on May 1, 2024. It is now read-only.
xamarin / Xamarin.Forms Public archive
[Bug][Android]App does not resume but restart activity after being put in background and re-opened #12050
Suprndm opened this issue Sep 8, 2020 · 18 comments
[Bug][Android]App does not resume but restart activity after being put in background and re-opened #12050
Suprndm opened this issue Sep 8, 2020 · 18 comments
p/Android s/unverified New report that has yet to be verified t/bug 🐛
Comments
Suprndm commented Sep 8, 2020 •
edited by StephaneDelcroix
Description
On Android, when the app is re opened after being put in background, and only after being freshly installed, the activity is rebuilt from scratch, instead of being resumed. All filled information is lost.
- Version with issue: 4.5.0.530
- Last known good version: N/A
- IDE: Visual studio 2019
- Android: 9
- Affected Devices: at least Oppo A9 , Samsung galaxy S7, and Huawei Honor 9
Steps to Reproduce
- Install a Xamarin App from store or APK, on Android
- Open the application
- Put the application in background
- Reopen it by tapping its icon
Expected Behavior
- the app is resumed in its previous states
Actual Behavior
- the app restarts, slightly reload, and display the initial page.
Basic Information
- It only occurs after a new installation. If you completely kill the application, and try to reproduce the issue, it will work as expected.
- You can try reproducing the issue with any xamarin app on the appStore,
- On apps not using Xamarin, i don't reproduce the issue
- It only occurs when installed from APK / store. I can't reproduce it from Debug in Dev env.
The text was updated successfully, but these errors were encountered:
ChristianTBaker commented Nov 3, 2020
Same issue for me on Android 11.
emjy86 commented Nov 19, 2020 •
Same issue on real device under Android 9.0 with Xamarin Forms 4.8.0.1687
App.OnStart is called instead of App.OnResume
archergod commented May 26, 2021 •
I have similar issue (not sure if it is same). But here is what I found. I am still in development environment and notice this issue.
- Start the application, in Emulator from Visual Studio. Go to Any flyout menu page.
- Press "Back" button in Andriod device.
- It unload the application in background.
- Bring app to foreground.
- It call App constructor and OnStart there after.
- Start App from Debugger,
- Open any flyout menu page.
- Press "Home button" to put app in background. (it is same list in android as pressing Back button)
- Bring app back in foreground.
- OnResume is called. and app didn't reinitalised.
So Android is putting app in 2 different state which might be causing different behavior when bring back from background.
Also, When I run app by tapping icon or first time it works without problem, but when it come from background to reinitialize it crashes as OnStart function behave differently, ie. in my OnStart I was syncing some data from server in sequence. But when it reinitialize it fail to sync data and cause data to miss their order of syncing causing error in my application.
Expected Behavior is
- It should treat bring from background as one. So OnResume is called everytime.
- If it is not "resume" then it should initialize completely not partially, (i.e. my FlyOut menu page try to load data before Onstart is finished ).