dimanche 29 mars 2015

Reading other application database in rooted device

I can read other app database by copying their database to sdcard folder but i want to read them without copying to sdcard folder but as you can see i got an error


please let me know if there is any way to read other app database wihtout copying database to sdcard



String [] cmd1 = {"su", "-c", "chmod", "777", "/data/data/http://ift.tt/1aGLTCy"};

try
{
Process process = new ProcessBuilder(cmd1).start();
process.waitFor();

} catch (Exception e)
{
e.printStackTrace();
}

SQLiteDatabase database = SQLiteDatabase.openDatabase("/data/data/http://ift.tt/1aGLTCy", null, SQLiteDatabase.OPEN_READONLY);

Cursor cursor = database.rawQuery("SELECT * FROM messages", null);


here is my error



03-29 16:10:36.181 2255-2255/com.example.john.viber E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.john.viber/com.example.john.viber.MainActivity}: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 3850): , while compiling: SELECT * FROM messages
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2247)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297)
at android.app.ActivityThread.access$700(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 3850): , while compiling: SELECT * FROM messages
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1090)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:663)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1420)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1359)
at com.example.john.viber.MainActivity.onCreate(MainActivity.java:60)
at android.app.Activity.performCreate(Activity.java:5250)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297)
at android.app.ActivityThread.access$700(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)

Aucun commentaire:

Enregistrer un commentaire