title: Using Akavache in Xamarin.Android/Xamarin.iOS
body: <p>I've successfully got <a href="https://github.com/github/akavache" rel="nofollow">Akavache</a> working for a Windows desktop, .NET 4.5 WPF project, but when I try to build it for the Xamarin (iOS and Android) targets, the <code>BlobCache</code> singleton is not properly initialized. <code>BlobCache.Secure</code> is null. (I've tried both the SQLite and 'vanilla' builds)</p>
  
  <p>I'll be honest, I find the examples/documentation for Akavache a bit thin. I'm not a user of the Reactive stuff, I find much of Paul's code very opaque. </p>
  
  <p>I'm just trying to do some very simple, secure caching of app state for a cross-platform app.</p>
  
  <pre><code>// where we store the user's application state
  BlobCache.ApplicationName = "myApp";
  BlobCache.EnsureInitialized();
  
  public AppState State
  {
      get
      {
          return _appState;
      }
      set
      {
          _appState = value;
      }
  }
  
  public void Load()
  {
      try
      {
          State = BlobCache.Secure.GetObjectAsync&lt;AppState&gt;.FirstOrDefault();
      }
      catch (Exception ex)
      {
          Debug.WriteLine(ex.ToString());
          State = new AppState();
      }           
  }
  
  public void Save()
  {
      try
      {           
          BlobCache.Secure.InsertObject("AppState", State);
      }
      catch(Exception ex)
      {
          Debug.WriteLine(ex.ToString());
      }
  }
  </code></pre>