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.
Related
some one suggested this but i am not able to implement it can any one can help me by providing the desired code in kotlin..
Another solution can be to call
UsageStatsManager.queryEvents
with the start of the day as first parameter and the current time as end parameter and then filter the results to check just the
UsageEvents.Event.SCREEN_INTERACTIVE UsageEvents.Event.SCREEN_NON_INTERACTIVE
events
take the timestamp of each of them and sum all the time passed between each
SCREEN_INTERACTIVE -> SCREEN_NON_INTERACTIVE
events, this would easily show how much time the screen was interactive, so screen on and the touch enabled.
There is a possibility that you'll have a SCREEN_INTERACTIVE event that doesn't have any related SCREEN_NON_INTERACTIVE, this is when the
UsageEvents.Event.DEVICE_SHUTDOWN
event happen, luckily this event is in the same list returned by the queryEvents method
remember also to declare and make the user to allow the android.permission.PACKAGE_USAGE_STATS permission as stated here
ps. i haven't used this yet but looking at the documentation it's the right thing to use, probably the one used by the android settings pps. look also to the other events in the same package, they might be helpful to what you want to accomplish
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.
I am working on a mobile app for Android. The app generates quite a lot of notifications, but they all have expiration tag on them. So, say, I don't want to display what was 2 hours ago if something, about the same subject, happened 1 hour ago.
Is there a way I can either
replace a posted message
or delete it in favor of a newer one?
You can use the Notifications Overview guide to see examples for various common notification use cases. The Notification updates and groups section has a couple of approaches that are relevant to your problem.
The simplest solution is to use the same ID in order to update the notification. As noted in the docs (quoted below), this will meet both your requirements.
To update this notification after you've issued it, call NotificationManagerCompat.notify() again, passing it a notification with the same ID you used previously. If the previous notification has been dismissed, a new notification is created instead.
You can optionally call setOnlyAlertOnce() so your notification interupts the user (with sound, vibration, or visual clues) only the first time the notification appears and not for later updates.
I am creating a TODO list app which accepts Notification time and date. Whenever i add a new scheduled notification my old notification get cancelled and the notification which i entered last alone works.
For example:
if i set a notification on 1,2,3 minute respectively i only get the final notification that is only one notification after 3 minutes.
Can someone explain how to clear this problem. If someone can pls share the code of broadcast and the defining and calling part of notification
I'm assuming, each notification replaces the previous one rather than generating its' own id. Fix that and you'll be on your way.
This happens because your notifications have the same id.
When you call NotificationManagerCompat.notify(id,notification),
use a different id for different notifications.
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