There is a phone with root rights, you need to periodically read the database of another from one application, the database is in a foreign application package. But SqliteDatabase.openDatabase() cannot open it, how to correctly request reading of this database?

    1 answer 1

    You must give / request your root application rights:

     Process root = Runtime.getRuntime().exec("su"); 

    The idea is pop-up menu pops up, where the user chooses to give root the application rights or not.

    After that you can already read the database in a foreign package.

    • I understand that a root request is necessary, but root just gives access to Bash commands, it doesn't help the opening of the database at all - Pasha Doncov
    • No, you have a wrong understanding of the role of root , Ruth is first of all permisens, but no way to access the console commands. Console commands are available - Barmaley
    • Perhaps so, but I tried to request root and open the database, gives Permission denied - Pasha Doncov
    • Root rights can have a process / application. You need to give root rights to your application ... There is a root in the phone - this is just an opportunity to give root rights. - Barmaley
    • in the end, run adb shell and from the console ask yourself for root rights via su , then go to the directory, then it will become much clearer to you - Barmaley