I am developing a crossplatform app with Xamarin and got stuck with this problem.
Every time I launch my app, all the data I had saved before is lost.
To give more details, I am using SQLite to persist some information and even storing some image files in the app's default directory. When I am running the app, I can persist everything successfully and even retrieve the data that I just persisted. But if I close the app and relaunch it, all the information and the files are gone.
To get the directory, I am using the code below, which is suggested in the Xamarin tutorials.
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var path = Path.Combine(documentsPath, sqlite Filename);
At the moment I am focusing my tests on the Android, so I don't know if it happens on the other platforms. I am also using the Trial License, maybe it is some limitation related to it.
I am also using Visual Studio 2013.
Does anyone have an ideia about it?
thanks
If by "launching app" you mean starting new debuggin session from VS just go to Tools - Options - Xamarin - Android Settings and tick "Preserve application data/cache on device between deploys" option.
Xamarin Studio should have same option somewhere.
If you are developing the app on VS and deploying it to a test device the data may not persist as I explain below.
What I discovered is that when I close the app on the phone (at least on the iPhone 12 I am testing with) and then reopen the app by launching it again on the phone, the data persists.
Now, if I then relaunch the app from VS the data still persists. Good.
However, when I make a change to the app I find that I need to eliminate the app on the phone for VS to install the new app. It is annoying, but I have gotten used to deleting the app on the phone before launching it again in VS. In this case the data does not persist. Removing the app on the phone removes its data as well. This all makes perfect sense but it was confusing when I first started testing my app with sqlite.
Related
I wrote a UWP program and I used Restricted capability
broadFileSystemAccess
When I published this application I obtained permission from Microsoft, and its now in the Microsoft Store.
But when I tried to install it, it got an error:
My computer: Windows 10 1809
I have tried googling this, and writing to Microsoft, both without finding a positive result.
First, make sure the problem is actually only with your app by trying to install some other app if that will work.
If this happens only with your app, you should definitely contact Windows developer support for this issue. Select Contact us tab, then Windows 10 UWP app development and submit your incident. They should be able to help. You can also post the problem on the publishing Forum for greater visibility.
Im developing a WPF aplication that saves some json under AppData\Roaming\MyAppFolder. During testing in VS2017 all was going as planned.
I generated the.appx for my project, installed and runned to see that no data was bing saved where I expected.
After using procmon I found out that the data was actually being saved under AppData\Local\Packages\Myapp_pn7t59nnjk55e\LocalCache\Roaming
Im using Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) to get the folder path.
Why exactly it changes when I run my app after installing using .appx?
Is there a way to actually save under AppData\Roaming?
Should I actually care about it?
The data is saved in the right location and your app will be able to read/load it without any problems.
That's where Windows 10 redirects AppData for modern applications, i.e. apps deployed using an appx package.
I have a strange situation. My windowsphone 8 app build with Xamarin and MvvmCross runs perfect from my debugger (visual studio).
Then I submit the app to the app store (beta store by the way). After that I downloaded it on my device and started the app. The splashscreen shows off... but thats it (I waited for about 5 minutes). No crash and no other information about what happens.
When I then go back with my backbutton or my start-button and restart the app. Everything works fine. This situation only occurs on the first time I start my app after downloading from the store.
Question: Is there someone with same issues?
Question: Is there a tool or something which I can use to log the device to get some more information?
Thank you
Assuming you are submitting to the Windows Phone App Store and the OS on the phone running the app is greater than v7.0.7355., you should be able to retrieve the crash dump data from the Windows Phone Dev Centre.
This will only cover crashes within an application and not the underlying OS code.
For more information see: Crash count reports
Check you don't have any code in the debug-only section of the App.xaml.cs
e.g. if your init code sits inside a block starting if ( Debugger.IsAttached )
I created simple WP8 application with database and I am having problems trying to submit it to store. Application is quite simple it allows to search through database that I attach to application. Everything works fine using all emulators and Lumia 620, but I am unable to successfully submit it to store. When I set my Database.sdf Build action to Embedded Resource I get following certification error:
The application cannot be tested for compliance for Windows Phone Application Certification Requirements because it fails
to launch on all Windows Phone devices. The application silently terminates at launch.
But when I changed Build action to Content application passed certification and was published to store. To make sure that everything works fine I downloaded it and was unable to run it, it closed immediately...
I managed to reproduce this error by opening MyApplication.xap and renaming Database.sdf to something else. So I think problem is with encryption and I should reference database in code differently, but not sure how. Any ideas ?
DbDataContext context = new DbDataContext(#"Data Source = 'appdata:/Database.sdf';");
I have been working on a Windows Mobile app for a little while now (havnt done much work with mobile before) and i have been having a problem when deploying to my mobile, at the moment i can only run the application once then if i want to run it again i have to do a soft reset.
Maybe im deploying wrong? (pretty sure i am actually, im pretty much just copying the .exe file across and running it.)
What is a better way for me to deploy my application so that it can run more than once per reset?
At the moment when i try to run it for the 2nd time on my mobile nothing at all happens (yet it works fine using the Windows Mobile 6.1 emulator)
CAB files are the preferred way to deploy Windows Mobile applications. Check out this MSDN article:
CAB Files for Delivering Windows Mobile Applications
I've had some success with putting a CAB file on a web server and simply http'ing to it to download and install the CAB.