Questions tagged [android-alarms]

Android alarms is the facility provided by Android through AlarmManager to start an intent at a given time (by passing a pending intent).

Android alarms is the facility provided by Android through AlarmManager to start an intent at a given time (by passing a PendingIntent) which can be used to start an activity or a service or send a broadcast.

AlarmManager Class Reference

1179 questions
2
votes
1 answer

Alarm manager not working when the app is closed . I'm using android 10

Intent i = new Intent(getBaseContext(), MyReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(MainActivity.this, 100,i, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager)…
Chetan Khanna
  • 248
  • 3
  • 12
2
votes
1 answer

AlarmManager & NEXT_ALARM_FORMATTED

I am setting alarams as follows: AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, calendar1.getTimeInMillis(), 24*60*60 * 1000, pintent); Like this i am…
karthik
  • 134
  • 1
  • 9
2
votes
2 answers

MediaPlayer (or Ringtone) doesn't start playing when the screen is off (phone is locked)

I'm creating a Reminder application (it's like an alarm clock) you can set tasks in it. The code for receiving the previously set alarm intent (with setExactAndAllowWhileIdle): @Override public void onReceive(Context context, Intent intent) { …
2
votes
2 answers

MediaPlayer - setAudioAttributes not working properly

I'm trying to create an alarm, everything is working fine but the stream type is always media even tho I use STREAM_ALARM, since setStreamType is deprecated, I'm using setAudioAttributes instead but it doesn't seem to work. here's my code : class…
Tamim Attafi
  • 2,253
  • 2
  • 17
  • 34
2
votes
1 answer

Android notification is not working properly with AlarmManager

I want to show notifications in my app daily at specified time , The notifications are working fine . When i launch my app for first time no matter what time it is i get a notification and when i click on that notification it takes me to…
user11437625
2
votes
1 answer

Check time every minute by broadcast receiver

I want to check the time every minute to make alarm app but when I but this in receiver
user11019720
  • 43
  • 1
  • 4
2
votes
1 answer

Using Android WorkManager for local Notification instead of AlarmManager

User selects a time to notify a message as a reminder that could repeat for everyday or only on certain day of the week.Previously I did this task by setting time to AlarmManager Calendar calSet= Calendar.getInstance(); …
ganesh
  • 1,247
  • 6
  • 24
  • 46
2
votes
3 answers

Android Notification Not Appearing As Heads Up

I am using the following to present notifications to users on Android which currently works fine but I am having an issue that the notification appears in the status bar but does not come up as a heads up like a Facebook or WhatsApp notification…
2
votes
1 answer

Alarm not waking my service while the app is closed

I want a service to be started every n minutes. This works, but only if the app is running (active on the screen or inactive, minimalised). When I close it (tap right bottom button and swipe to the side), the service stops being started. Setting up…
Martin Heralecký
  • 5,649
  • 3
  • 27
  • 65
2
votes
1 answer

NotificationChannel notification as alarm when phone is muted (Oreo)

I'm setting the NotificationCompat.Builder with: .setSound(getNotificationSound(), AudioManager.STREAM_ALARM) .setCategory(NotificationCompat.CATEGORY_ALARM) .setPriority(NotificationCompat.PRIORITY_MAX) among the other mandatory properties. For…
2
votes
1 answer

AlarmManager PendingIntent.FLAG_NO_CREATE return not null after cancelling alarm

I'm writing Android application in Kotlin. In some situations I'm using there AlarmManager to schedule task every 1 minute to do some action and in some condition cancel future calls. Before setting up alarm I'm checking if it was already scheduled…
user3626048
  • 706
  • 4
  • 19
  • 52
2
votes
1 answer

Is WakefulBroadcastReceiver (or equivalent) necessary with AlarmManager

I am using setExactAndAllowWhileIdle with an AlarmManager in API 25 and above. I am furthermore using a “standard” BroadcastReceiver for receiving the PendingIntent triggered by the Alarm. Moreover, WakefulBroadcastReceiver (which appears to be…
JF0001
  • 819
  • 7
  • 30
2
votes
1 answer

AlarmService sample error building can't find AlarmService_Service.class

AlarmService sample error building can't find AlarmService_Service.class. What am I missing? Code: public class AlarmService extends Activity { private PendingIntent mAlarmSender; protected void onCreate(Bundle savedInstanceState) { …
Java Review
  • 427
  • 2
  • 9
  • 20
2
votes
4 answers

PendingIntent with IntentService not working

Following code works perfectly for Activity: Intent intent = new Intent(context, MyActivity.class); PendingIntent operation = PendingIntent.getActivity(context, 0, intent, …
2
votes
4 answers

android: scheduling job every hour forever

I have a web service on my server that needs to be pinged every hour. For this, I am using an Android app to ping it every hour. I have tried using Alarm manager but it stops working after few hours and if I swipe exit it. I have tried using service…