0
!!私は問題が電子メールであることを認識しました。私は電子メールが日常的に起こるようにスケジューリングしたいので、自動化する必要があります。 !!電子メールデータベースが動作しない
データベースのコピーを電子メールで送信したいのですが、ファイルをSDカードにエクスポートしてから電子メールで送信する必要がありますが、これは私が行ったことですが、実行しようとすると「このアプリケーションは実行されません」というエラーが表示されます。私はSDを有効にしているアンドロイドエミュレータを使用しています。
public void sendEmail(View view){
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_SUBJECT, "Daily Records");
email.putExtra(Intent.EXTRA_EMAIL, new String[]{ "[email protected]"});
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
FileChannel source=null;
FileChannel destination=null;
String DB_NAME = "inoutDB.db";
String currentDBPath = "/data/"+ "mypackagename" +"/databases/"+DB_NAME;
String backupDBPath = DB_NAME;
File currentDB = new File(data, currentDBPath);
File backupDB = new File(sd, backupDBPath);
try {
source = new FileInputStream(currentDB).getChannel();
destination = new FileOutputStream(backupDB).getChannel();
destination.transferFrom(source, 0, source.size());
source.close();
destination.close();
email.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(backupDB));
} catch(IOException e) {
e.printStackTrace();
}
startActivity(Intent.createChooser(email, "Send Email"));
}
私は私のマニフェスト
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
データファイルにアクセスできない –
データファイルにはどのようにアクセスできますか? – helpmeplease
この質問を管理者に行う必要があります。 –