-
Notifications
You must be signed in to change notification settings - Fork 55
In iOS Mobile app lost session variable data #238
Comments
The Session and Local Storage is cleared at each app initialization. This is by design on the Web part for this project. However you can store your data directly on the native side, and retrieve it at any time when needed with interop. See: #231 When your code will reach the native service/interface you will have implemented, use any Storage logic you wich to store your data on the native side. When i used this on some project in the past i used SQLite , but you may store anything differently (A file , a native private store...) |
Hi @Daddoon The issue message are "blazor mobile not able to connect to native through websocket server execute task" comes when iOS app again use after 30 min or sleep mode. You provided me above some points, but I always this native approach to share the variables in my application. |
Do you have this issue on all iOS devices (if you have many) ? I don't maintain this project specifically anymore now as you can, i think, migrate easily to .NET MAUI for Blazor on Mobile. I think the WebServer does not restart correctly after app restore (but it was working in the past). But you may try some "hackery" and test on your side. The idea would be, by yourself, to try to override any logic on your side when the app is restored (returning from sleep mode), and try to Restart manually the webserver. You would use: BlazorMobile.Services.WebApplicationFactory.ReloadApplication(); (Source code here if needed: https://github.com/Daddoon/BlazorMobile/blob/ec3d6e4dc290fc0e9347f5a894141c0e891fdfe2/src/BlazorMobile/Services/WebApplicationFactory.cs) |
Hi @Daddoon Thank you so much for give me solution. But When I apply.this code on the my App.xml.cs page in the OnResume and OnStart or one of them it not work for the iOS issue. The issue are when the application goes to Sleep or Resume state and we come back to application application loss his native approach variable data. Please provides me some others solution for that. Thanks |
Have you done some debug to test this behavior ? Do you have anything right or wrong while restarting the webserver ? |
@Daddoon But When I kill my application on iOS and click on the icon of app for reopen after this all things working. I am facing issue when my iPhone goes to sleep mode or resume mode. |
What do you mean by "You loss the native variable ?" Where are you storing your data ? Wich API ? |
Hi @Daddoon |
Sorry, but i have considered that this project is now discontinued. I neither have the time to debug anymore and you have an alternative solution with .NET MAUI that does exactly the same and is supported by Microsoft. Consider migrating your codebase on this new model. See the README page of this repo. |
Hi @Daddoon
Hope you are doing well......
I use the blazor for the web application, Android app and iOS app.
I am facing issue to lost the session variable data in the iOS app when application goes to background or screen lock for 30 min above.
Session variable e.g. key or others details.
What I do to share the session variable from main application to Android and iOS application without lost it if takes long time if mobile sleep.
The text was updated successfully, but these errors were encountered: