1

First of all, please consider that I am a newbie to Xamarin.Forms and mobile app development in general, hence solution to this problem might be something pretty easy. Nevertheless, I did a lot of googling without any working solution.

My app is in Xamarin.Forms (c#) and I am using Visual Studio 19. I am testing it on Xiaomi phone.

I am dealing with a problem that occurs when deploying an app to phone. It only happens after some changes in AndroidManifest.xml (so I guess some kind of "deep" changes) and after uninstalling and reinstalling the app. The problem is that I store some SQLite data which I need to stay in the phone even after uninstalling (I need the data to be visible after opening the same app after reinstallation). But the app remembers some data which were an actual input like a week ago but doesn't restore (after reinstalling) anything newer than that. I'll give an example to demonstrate it better. I've stored something into SQLite database yesterday and today. When I uninstall the app, then I click the start-debugging button, it successfully builds, deploys etc. but after the app opens, it only shows the data from a week ago (and no yesterday/today input).

Now, in Android documentation, I've read that the auto backup (from phone to Google Drive) happens roughly once a day (if android:allowBackup="true", but that is by default). I've also read that putting android:fullBackupContent="true" in <application> (which is in AndroidManifest.xml) might help, but didn't in my case. I also know, that in VS there is this: Tools -> Options -> Xamarin -> Android Settings → "Preserve application data cache on device between deploys" (I have this ticked)

So my question is, how can I get my complete SQLite database even after reinstalling? Is there a way that I can save data X into SQLite database, 1 minute later uninstall the app, then install it back and see data X?

by the way, my manifest looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.myappname">
  <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
  <application android:label="myappname.Android"
               android:allowBackup="true"
              android:fullBackupContent="true"></application>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Hopefully, I have explained everything enough.

Thank You.

11
  • is the adb command being executed to install the app showing in your output window in xamarin ? Commented Mar 25, 2020 at 19:36
  • I don't know much, but as far as I understand the output, it gets adb list of devices. Then this is executed: [D:RunShellCommand]: (some device number ID) pm install -d "/data/local/tmp/com.companyname.myappname-Signed.apk" Commented Mar 25, 2020 at 19:51
  • I think your IDE (Xamarin) uninstalls the app first and then install the new one, which version are you using? are you using msbuild ? Commented Mar 25, 2020 at 19:56
  • MS documentation says: "MSBuild is the build platform for Microsoft and Visual Studio." if that is the default option, then yes, I'm using it. If not, then not, because a didn't change anything like this Commented Mar 25, 2020 at 20:02
  • 1
    But I'm fine with the app being uninstalled and then reinstalled (it has to go like this if there's been some "deep" change, as I have specified in the question itself), but I want the data I input to stay there even after reinstalling. But I only get some data which appearently were backed up a week ago. So if I had a table with columns of days where I manually add the days every day it would have kept showing me the same number of days after a week because it would have rembered only the input a week ago. I hope it makes sense Commented Mar 25, 2020 at 20:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.