I programmed a simple calendar app where you can add Events to specific Dates.
When I close the app it still should check once a day which Date is it and if an Event is on this Date. If there is an Event a push notification shall appear.
How could I do that? I save the Date with an event within the sharedPrefrences.
Can someone help?
If it doesn't matter when during the day the notification is sent, then #AliasCartellano comment is correct. However, if you want to send the notification at a specific time during the day (i.e. not at 23:59 when the user is sleeping), then you should use AlarmManager. Specifically, look at setAlarmClock(). This is its intended usage.
Related
I am trying to send Outlook meeting request with Java. When I send in UTC, Outlook adjusts the timezone to client's calendar and shows. What should I do to make the client not to adjust automatically to client's timezone?
Ex.: If I send a meeting for 5PM Pacific to a client who is in Eastern, it should still appear as 5PM in client's calendar.
My request has:
DTSTART:20181029T070000Z
DTEND:20181030T070000Z
If you want an event to appear at the same time of the day, regardless of the timezone of the attendee, you want to use floating time. It is essentially the same syntax, without the final Z. See https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5 , e.g.
DTSTART:20181029T170000
for an event that shall start at 5PM wherever the location of the recipient.
Beware though that this is a really strange thing to do for meetings. If you have an organiser in one time zone and attendees in other timezones on a conference call, they will end up dialing in at different times. Is this really what you want ?
I habe a app for event informations an app which sends pushmessages. Now I want to give the user the option to disable the messages for a specific time (one hour, one day ...). I know how to dissable it compleatly, but how I can set it like I want (one hour...) even if the app is closed?
Well, the simple solution would be to check if there is a time restriction is present in the same place where you notify user for event information. If there is a time restriction dont show the notification else show it
I'm downloading a certain website in html format to my device, so that I can display it in webview in offline mode. The only problem is that the link is dynamic, and it changes once a week. To keep the html item updated as much as possible, I want the app to download it once a week.
Let's say for example that this is the websites address:
www.mywebsite.com/1
Next week, the address will be:
www.mywebsite.com/2
And week after that, the website will be:
www.mywebsite.com/3
I already figured I would do this be declaring a variable that would be changing, something like
int week;
String urlToDownload = "www.mywebsite.com/" + week;
But how do I make it so that this variable will change everyday even if the app is not started, or is there a better way to do this?
You can maybe use AlarmManager class. That allows you to plan something on the background, when app is not even running.
I would use the most simple solution. Do you know what time does the URL change? You can always check the time of previous start of application and when next app is started check it and determine how many weeks is from that.
Use the java.util.Calendar
Calendar calender = Calendar.getInstance();
MyLog.d("Current Week:", "" + calender.get(Calendar.WEEK_OF_YEAR));
This prints "Current Week: 37"
With that maybe you can write code to get the appropriate page. The week nr are kind of static
You can update the variable during the onStart() phase. Make a constant that has the start date, and then get the current date and figure out the offset. This way even if the app hasnt been started in a long time, once it is started you will have the proper link.
My Android application needs to set a number of alarms over the next few weeks using the AlarmManager. As of now, I'm planning to hard code those date/times using an array of calendar objects.
The question I'm facing is, how do I handle different timezones? Supposing I set an alarm for
2nd August 2012 15:00 GMT , how do I make sure that a person using the app somewhere else (say India i.e. GMT+5.30) gets the alarm at 2nd August 2012 20:30
Is there a way the app can get the timezone difference (i.e. the '+5.30' part) of that particular device so that before setting the alarm, to each Calendar object I can add that difference and then set the alarm?
I would suggest you to use System.currentTimeMillis(), Which should return u the time of system depends on what timezone the phone is in
I'm trying to update the alarm time that is set when calendar events are inserted.
I've searched through net and got a final that the event alarm can be cancelled and the particular event alone can be updated with new time for alarm. I'm struck out here how to implement it. Any help is highly appreciated and thanks in advance...
You don't want to be messing with the calendar. It's not part of the Android API, and even if there exists a back door, it is highly discuraged to use it.
Even if you want a "Snooze" functionality, you won't be able to capture the Intent that causes the alarm to go off, as this is not an API standard, and may be fired targeting a specific receiver class.
You can however access and modify the calendar entries through the Google Data API, but that's a whole different story.