Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alarm repeat frequency #69

Open
ciwchris opened this issue Jun 19, 2013 · 3 comments
Open

Alarm repeat frequency #69

ciwchris opened this issue Jun 19, 2013 · 3 comments

Comments

@ciwchris
Copy link
Contributor

I was thinking about adding more preferences for the alarm. One setting to control how many times to execute the alarm and another setting to control the time between them. I was thinking of using a ListPreference for each setting from which the user could select a value. Thoughts?

@Decad3nce
Copy link
Owner

The feature has been requested quite a couple of times and I really do want to implement it. Problem is how to do the logic.

Currently the receiver, once getting the sms trigger, triggers a notification with sound.

In > Android 4.0, this is the only way to trigger a sound without using a service, so it's the easy route.

Anyway, to have such an option I'd have to create that said service, then spawn it from the receiver. The service would host a handler for the intervals that you mention in the list preference. A click on the notification(ideally) would do a removeCallbacksAndMessages call.

@ciwchris
Copy link
Contributor Author

I was looking into this some. I was planning on using a Runnable with a Handler. Call it like so:

Handler handler = new Handler();
Runnable runnable = new AlarmNotificationRunnable(mManager, notification, repeat, delay);
handler.post(runnable);

And use it like so

@Override
public void run() {
  mManager.notify(1336, notification);
  if (++alarmCount < alarmTimes) {
    handler.postDelayed(this, alarmDelay);
  }
}

I'm not entirely sure what the consquences would be of implementing it like this though. I'm also not sure how to cancel it if it was implemented like this, but I have some ideas. I'm not sure I would want to be able to cancel it though. If someone had my phone, and for some reason it wasn't locked, I wouldn't want them to be able to cancel it.

@Decad3nce
Copy link
Owner

I've reimplemented alarm duration. Is repetition a necessity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants