Is it possible to read/write to SQLite on a removable USB Flash Drive

  • Replies:2
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Apr 6, 2018 12:41:34 AM via Website

Is it possible to read/write to SQLite on a removable USB Flash Drive, by this I mean the app is installed on the phone, but the data used by the app would be stored on a removable USB flash drive that plugs into the USB/Charging port.

I have been reading a lot and for the most part references to this suggest the data must be in the same location as the app. I need the data to be external to the app so different databases can be used as required. If it is possible, I would appreciate a reference to some example or explanation.

thanks

Reply
  • Forum posts: 768

Apr 6, 2018 4:04:01 AM via Website

We can read/write to SQLite on a SD card. So I think you can do on an USB drive, too.

public static final String DATABASE_FILE_PATH = "/sdcard";
public static final String DATABASE_NAME = "testDatabase";

database = SQLiteDatabase.openOrCreateDatabase(DATABASE_FILE_PATH + File.separator + DATABASE_NAME, null);

Apk size only 0.07 MB. The pure & full-free app is available on Google Play - https://goo.gl/ws42fN
Google Blog - https://okblackcoffee.blogspot.com

Helpful?
Reply
  • Forum posts: 15

Apr 6, 2018 5:41:36 AM via Website

Hi Mark,
Yes, you can save the app on your SD card which will work same as the app is installed on the phone, however, it is still best for all our apps both internal and external to be installed directly to the phone memory. Hope this helps

Helpful?
Reply