次の方法を使用して、現在の時間を sharedPreferences で共有しました。
日付 date = new Date(System.currentTimeMillis());
SharedPreferences pref = getApplicationContext().getSharedPreferences("DataCountService", 0);
long millis = date.getTime();
SharedPreferences.Editor editor = pref.edit();
editor.putLong("smstimestamp", date.getTime());
editor.commit();
ここで (後日ソース コードで) 現在の時刻と共有設定に保存した時刻を比較して、30 日が経過したかどうかを確認する必要があります。
これを行う最良の方法は何ですか?