How to copy sms database from rooted phone to sd card programatically
<p>I have rooted phone. 
I want to copy data/data/com.android.providers.telephony/databases/mmssms.db
file to sd card programatically.</p>

<p>I am getting error like 
<strong>java.io.FileNotFoundException: /data/data/com.android.providers.telephony/databases/mmssms.db (Permission denied)</strong></p>

<p>Please help me.... </p>

<p>Thanking you in advance...</p>

<p>I am using below code to copy database in sd card
         '
try {            </p>

<pre><code>            File sd = Environment.getExternalStorageDirectory();
            String path = Environment.getDataDirectory().getAbsolutePath();
            File data = Environment.getDataDirectory();
            String currentDBPath = "/data/com.android.providers.telephony/databases/mmssms.db";
            String backupDBPath = "/bkup/mmssms.db";
            File currentDB = new File(data, currentDBPath);
            File backupDB = new File(sd, backupDBPath);
            // Local database
            InputStream input = new FileInputStream(currentDB);

            // Path to the external backup
            OutputStream output = new FileOutputStream(backupDB);

            // transfer bytes from the Input File to the Output File
            byte[] buffer = new byte[1024];
            int length;
            while ((length = input.read(buffer))&gt;0) {
                output.write(buffer, 0, length);
            }

            output.flush();
            output.close();
            input.close();
    } catch (Exception e) {
        // TODO: handle exception
        Toast.makeText(this, e.getMessage().toString(), Toast.LENGTH_LONG).show();
    }`
</code></pre>
