Testing Akavache on Xamarin Android with a Shared PCL Library
This repo is for testing Akavache's persistence across Xamarin Android app restarts when it's being hosted in a shared library.
It uses some basic ReactiveUi wizardry for hooking up the buttons and the textbox/label. If you're not familiar with RxUi then that doesn't matter, because it has no bearing at all on the initialisation and usage of the Akavache stuff.
Quick-start (using the Akavache global static instance):
- Run the app (deploy and run, don't run inside a debugger, because if you relaunch it with the debugger, it'll probably clobber everything).
- Type something in the box, and hit the "save" button (your text should appear in the label).
- Close the app.
Remove it from the backstack, or reboot the phone, or make sure the app is completely closed some other way (don't uninstall because that wipes everything!)
- Launch the app.
- Hit the "read" button
- The text you typed in previously should appear.
Instantiating Akavache (perhaps you need IoC or because reasons)
If you're interested in instantiating an Akavache instance (IBlobCache), switch to the
instantiate-blobcache branch and have a look at the differences to
SharedAppGlobal.Init(), and where the initial path is set (this will need to be done in your platspec project and passed down to the shared lib) in
You can then reference the instantiated version in the shared library, and Akavache will take care of all the cache file location setup, database initialisation, etc. It also takes care of supplying an encryption provider and a task scheduler for the threading/async stuff.
Happy caching! :)