android - MvvmCross FilePlugin save files to SD card -


we use beautiful mvvmcross framework in our app , utilize fileplugin work filesystem in cross-platform way.

by default fileplugin stores data in default location, /data/data/<appname> in android. if want store big files, video or 3d models? in ios store in app folder, in android you'll want store files on sd card.

what solution recommend usecase? mean, should inherit fileplugin , override app root directory android somehow?

i hade same problem, , solved creating own implementation of imvxfilestore. implementation allows me specify absolute path.

internal class custommvxandroidfilestore : mvxfilestore {     private context _context;      private context context     {                 {             if (_context == null)             {                 _context = mvx.resolve<imvxandroidglobals>().applicationcontext;             }             return _context;         }     }      protected override string fullpath(string path)     {         if (pathisabsolute(path)) return path;          return path.combine(context.filesdir.path, path);     }      private bool pathisabsolute(string path)     {         return path.startswith("/");     } } 

and inject during setup of app:

mvx.registertype<imvxfilestore, custommvxandroidfilestore>(); 

this worked fine me.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -