5
donuts
6y

Was motivated to do a project with ReactNative for Android but already stuck.

I need to read a SQLite DB file from /data/data/some.other.app/database/DB.db

Yes I am rooted.

1. How does I request root from the App (Android Pie)
2. What SQLite npm package can load from an absolute path. I found a few libs but they don't seem to be full access, just for dbs in the app's own data folder.

Comments
  • 0
    I know it's not what you were asking for but it sounds like you are getting stuck in the details already. It happens to me a lot and killed many home projects. Maybe try to focus on other things first and hardcode the data first.
  • 0
    @ShotgunSurgeon this is not really the details, this is the critical path. If I can't get these 2 details, then this project cannot be done in ReactNative.

    And then I need to decide how badly do I want this app and is it worth relearning Android to get it. Probably not since the usage is pretty much just for me.
  • 1
    Ok than I hope you can get your answers before your fire for this project goes out! Wish you good luck, I would help if I could
  • 0
    Do you NEED sqlite? There are a bunch of kvs libraries for rn.
  • 0
    @tekashi notice the requirement for root and fs access.

    I need to access the DB of another app
  • 1
    As far I know root can be requested by calling the su binary, at least for system commands and and a shell. The 'root manager' will then ask the user to confirm the access.
    I've seen a few apps doing so, but I don't know how to get any further.
  • 0
    @sbiewald but after I call su. Then I can do like

    let db = SQLite.openDb("/data/.../app.db")

    And not going to return a File not found error?

    Also I don't know whether the ReactNative lib can even open DB by an absolute path.
  • 0
    @sbiewald that worked but now after spending all night it seems basically it would be easier just to write the SQLite part in Java n then use RN bridge.

    So if I really want to continue (TBD) I just use the React part for the GUI... most of the work would be in Java.
Add Comment