是启动 IntentService 的正确方法吗?我进行了递归调用,因为我需要更改警报滴答声。
public class AlarmIntentService extends IntentService{
@Override
protected void onHandleIntent(Intent intent){
SharedPreferences spf = getSharedPreferences("PREF_SOMETHING", MODE_PRIVATE);
intent = new Intent(this, AlarmIntentService.class);
PendingIntent pIntent = PendingIntent.getService(this, 0, intent, 0);
AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarm.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + spf.getInt("TIME", 1) * 10000, pIntent);
}
}