How can I monitor another application's database for changes?

前端 未结 4 2088
北荒
北荒 2021-02-19 10:35

I\'d like to monitor changes to another applications SQLite database. Since the Android doesn\'t allow me to access another application\'s internal data, I need a root applicati

4条回答
  •  别那么骄傲
    2021-02-19 11:38

    You can't access it from Java.

    One way is poll: to run ls -l /data/data/com.target.app/databases/data.db and get time-stamp periodically.

    Or perhaps use watch or tail commands.

    May be a background service can run this and issue a local broadcast.

    Other way is to ship SQLite3 binary with your app, start process as root, and supply commands to it. I think many apps like titanium etc, do this.

    Update: Here's an SQLite3 project: http://code.google.com/p/sqlite3-android/

提交回复
热议问题