アプリケーションが初めて起動したときに、AndroidでAsyncTaskを1回だけ実行したい。
onCreate に Shared プリファレンスを入れようとしましたが、うまくいきませんでした。他のアイデアはありますか?
SharedPreferences prefscrt = PreferenceManager.getDefaultSharedPreferences(this);
if(!prefscrt.getBoolean("firstTime", false)) {
Log.d("DownloadManager", "Installing First Time");
new Task().execute(); //THIS WON'T WORK
SharedPreferences.Editor editor = prefscrt.edit();
editor.putBoolean("firstTime", true);
editor.commit();
}
よろしくお願いします