I try to use datepicker to set the time, and I also built an alarm for that time I set, but the alarm always paly at current time instead of my set time, I don't know why, please help, thanks! here is my code:
You should remove this line:
alarmTime.setTimeInMillis(System.currentTimeMillis());
as it set the time of the calendar to current time.
Related
I am working on one android application which allows user to set reminder for specific task or work. and i have created reminder in android using alarm manager. But my problem is when user move to some other time zone how can i change reminder time as per new time zone ?
2nd problem is if user have set reminder for two task at same time which one will get canceled by system ?
As android doesn't provide id for reminder.
I have already checked link1, link2 questions on SO but it is not valid for me in my 2nd case.
You should not to do that becouse you set it up in abcolute unix time value right?
It means that the same absolute time event will happens in the same moment in every time zone
P.S to cancele alarm you should use the same Intent as you use whent setup alarm. It just override previous alarm by new one. In my application i use only one alarm for all events, and i invalidate it value every time and set it up to earliest event time
I want to start an activity if the clock is 15.00. Is there any reference ?
Assuming i had running services in my background.
EDIT
I have value from database. Then the activity will trigger based on clock that i saved from database. So if the database has values like 01.00 , 13.00 , 22.30 then the activity will start when the phone clock match as that 3 value.
You can use an AlarmManager for that
This post will help you. Use AlarmManager to set a repeating alarm. The time can be set.
Android notification app not working properly
The android alarm duration is basically at 1min (I think).
I would like to change it, so I can set the length/the duration at 4min for exemple (the duration of a song).
Can you tell me which methods I can call to change it ?
Can you guide me please ?
Thank you in advance !
I think you can use AlarmManager for this. http://developer.android.com/reference/android/app/AlarmManager.html
It has setRepeating method where you can set the interval you want (the second parameter is time in milliseconds that the alarm should first go off).
I have an array of specified hours for each day, when brightness should by changed for application which is awake 24/7. It happens twice a day.
What I want to achieve is to find the most economical way of implementation that problem.
Should I use AlarmManager or maybe there is a better sollution?
Activity is always awake...
If your app doesn't show any UI while it's awake, use the AlarmManager.
Finally, I decided to use an AlarmManager with BroadcastReceiver setting value in SharedPreferences and then in Activity I have a Handler which checks that value.
I'm using status notification in my android app and i want to create a notification that is fired on a date I have set. For example, I want to fire a notification tomorrow at 9 pm. When i try to set a date in the when parameter the notification just fires instantly instead of at the date and time that i set.
Your help would be most appreciated
You could use the AlarmManager for that