Debug as upgrade instead of new deployment to retain data?

Hi,

I am wanting to test how a user upgrade would impact their existing database with database table changes.. how can I do this using the debug on device from Monodevelop?

Every time I debug it removes all the old data from the application and starts fresh.

Cheers,
Le-roy

Posts

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    Maybe someone from Xamarin will correct me, but I do not think it's possible to do this through debugging form Monodevelop/Xamarin Studio.
    Instead you should probably let Monodevelop build the .apk without running it, and then push it to the device/simulator manually using the adb -r command.
    You could use ProtoPad (sorry, self-advertising a bit here :-P) to connect to the running after the update, to 'debug' and inspect without running the Monodevelop debugger.

  • Le-royStaines.7824Le-royStaines.7824 NZMember ✭✭✭

    Cool, thanks Jonathan! I'm using Monodevelop it was Options > Other > Mono for Android > Preserve data/cache between application deploys.

  • Jonathan - how does one do the same for iOS? TIA.

  • CheesebaronCheesebaron DKInsider, University mod

    @jeff7091 I guess that is better suited for the iOS forum, wouldn't you agree?

  • WilliamJockuschWilliamJockusch USMember ✭✭

    This has moved; it is now under Xamarin Studio > preferences > projects > android

  • BryanPoteetBryanPoteet USMember ✭✭

    What does one do if Preserve data/cache is checked and it still removes everything?

    Currently I have to set a break point just before it attaches to the database so I can copy the data back to the app folder using Root Explorer. It's getting old but I don't know what else to do. This behavior is in both VS2013 and Xamarin Studio. I'm running the latest stable version of Xamarin.

  • BryanPoteetBryanPoteet USMember ✭✭

    What does one do if Preserve data/cache is checked and it still removes everything?
    I guess resetting your phone works. I factory reset my phone and upgraded to Android 5.1.
    After the upgrade/reset the data sticks. Finally.

  • TheosTheos NLBeta ✭✭

    I resetting the phone really necessary? I've the same issue on one of my devices (OnePlus One). It's not keeping the data/cache between debug deployments, which is frustrating. On other android the data is preserved fine.
    Just would like to hear someone else to confirm I've to reset my device as I prefer not to reset it now ;)

    Thanks!

  • TheosTheos NLBeta ✭✭

    I just installed the latest CM nightly (5.1.1) and did a factory reset. Now my data/cache is preserved between new debug deployments.

    So, yes this is the solution ;)

  • BradChaseBradChase USMember

    Just wanted to say thanks! Saved me SOOOOOO much time! Our cache is quite large and it takes a very long time to load everytime I debug. Now its instant! Thank you thank you thank you!

  • ThiagoGuitarThiagoGuitar BRMember

    @Theos said:
    I resetting the phone really necessary? I've the same issue on one of my devices (OnePlus One). It's not keeping the data/cache between debug deployments, which is frustrating. On other android the data is preserved fine.
    Just would like to hear someone else to confirm I've to reset my device as I prefer not to reset it now ;)

    Thanks!

    I just clean the App Data and App Cache, then it worked!

  • BenjaminPettitBenjaminPettit USMember ✭✭

    This was broken completely on Visual Studio Community 2017 for Mac
    Version 7.3 (build 799) and Visual Studio on windows but fixed in Visual Studio Community 2017 for Mac
    Version 7.3.3 (build 12)

  • _andyng_andyng Member ✭✭

    "Preserve data/cache between application deploys"

    This feature doesn't work on Visual Studio For Mac 7.7.3 build 43.

    it wasted too much our time.

  • LesterMeeksLesterMeeks USMember ✭✭

    I am also seeing this feature is not working as it was previously, in android. I have the setting checked but every deploy I have to reenter my login data and download our cache. Same version as @_andyng above Visual Studio For Mac 7.7.3 build 43, though I think that it has been happening for a while.

  • DooksDooks ZAMember ✭✭✭
    edited April 2

    I had to resort to creating my database.db file in the external storage directory when debugging, and then publishing to Google Console, set it back to normal path. This only happens with my Samsung Galaxy S9 android 8.0.0 but not with my Galaxy S7 android 8.0.0

    //External path
    var externalpath = Android.OS.Environment.ExternalStorageDirectory + Java.IO.File.Separator + "MyApp" + Java.IO.File.Separator + "DB" + Java.IO.File.Separator + "mydb.db";
    
    //Normal path
    var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
    var path = System.IO.Path.Combine(documentsPath, "mydb.db");
    
  • EliranEliran USMember ✭✭

    @Dooks said:
    I had to resort to creating my database.db file in the external storage directory when debugging, and then publishing to Google Console, set it back to normal path. This only happens with my Samsung Galaxy S9 android 8.0.0 but not with my Galaxy S7 android 8.0.0

    //External path
    var externalpath = Android.OS.Environment.ExternalStorageDirectory + Java.IO.File.Separator + "MyApp" + Java.IO.File.Separator + "DB" + Java.IO.File.Separator + "mydb.db";
    
    //Normal path
    var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
    var path = System.IO.Path.Combine(documentsPath, "mydb.db");
    

    Man your solution for the problem looks strange, but I have exactly the same problem, and I afraid it will be the only
    way to deal with this situation. Did you find another solution for this? and why didn't you leave the location in the external
    storage directory?

Sign In or Register to comment.