android-alarms

Android Alarm Manager setExactAndAllowWhileIdle() not working in Android 7.0 Nougat in Doze mode

徘徊边缘 提交于 2019-12-30 01:51:05
问题 I am trying to make an alarm fire in my app every 30 minutes using Alarm Manager's setExactAndAllowWhileIdle but it is not working! I test the functionality by issuing a push notification whenever I receive an alarm signal. The problem is: when the device enters doze mode after being idle for sometime, I no longer receive alarms. However, as soon as I turn On the screen, I receive a notification. My app needs accurate alarms that need to be delivered exactly on-time every 30 minutes! It can

android repeat alarm for every monday or every tuesday

假如想象 提交于 2019-12-29 01:26:48
问题 I am developing an alarm based application, in which i have to repeat the alarm for every weekday like (every monday, tuesday, wednesday) based on user input. I used this snippet Intent intent = new Intent(context, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, alarmToSetInMilliSeconds, sender); If user selects

Alarm with broadcast receiver not working on Fragment

旧巷老猫 提交于 2019-12-25 07:58:54
问题 I'm working on a app with Fragments, One of the fragment includes alarm functionality. For this I have used broadcast receiver but don't understand why its not working: Here is the code, I'm working on PC "not a Mobile device" public class SchedulerListFragment extends Fragment { PendingIntent pendingIntent; AlarmManager alarmManager; BroadcastReceiver mReceiver; EditText ethr,etmin,etsec; int result = 1; int hr = 0; int min = 0; int sec = 0; Button alarm; IntentFilter filter1; private void

Android service scheduled on AlarmManager not starting

久未见 提交于 2019-12-25 07:31:21
问题 I have a service (properly declared in the Manifest file) that upon onDestroy() schedules itself to start again one minute later via AlarmManager . However the service is not starting even though onDestroy() runs correctly. What could be wrong? The scheduling code: @Override public void onDestroy() { BroadcastReceiver br = new BroadcastReceiver() { @Override public void onReceive(Context c, Intent i) { c.startService(new Intent(c, MyService.class)); } }; registerReceiver(br, new IntentFilter(

Getting battery status even when the application is closed

好久不见. 提交于 2019-12-25 03:03:42
问题 Hey I am trying to make an application that tells me when the battery is full when the phone is connected to power. I made a service and used a broadcast receiver in that to check the battery status. Whenever i connect or disconnect the phone from the power, my app crashes. The service still runs and i get the notification when battery is full. I dont know why is the app crashing again and again. Here is my code public class Srvc extends Service{ @Override public int onStartCommand(Intent

How to set android reminder/alarm?

孤者浪人 提交于 2019-12-25 02:44:29
问题 I have got some times stored in ISO format. Some of these times are flagged to either 1(on) or 0(off) set in another column. I need to set a reminder at the times flagged to 1, but how would I pass that each date to the reminder class? 回答1: There is no public API for the Alarm Clock application. There is no public API for the Calendar application, though since it is a native UI for a Google Calendar, you could push an event over to the Google Calendar via its GData API. 回答2: ContentValues

MediaPlayer - setAudioAttributes not working properly

北城余情 提交于 2019-12-24 20:52:41
问题 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 AlarmRingtoneManager(val context: Context) { private lateinit var mediaPlayer: MediaPlayer fun start() { mediaPlayer = MediaPlayer.create(context, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM)) .apply { setAudioAttributes(AudioAttributes

Alarm Clock from GIT - Gives error - Android

余生颓废 提交于 2019-12-24 17:16:38
问题 I downloaded the alarm clock example from the below link: https://github.com/android/platform_packages_apps_alarmclock I fixed most of the except the following: Alarms.java: Line 463: Intent alarmChanged = new Intent(Intent.ACTION_ALARM_CHANGED); Error: ACTION_ALARM_CHANGED cannot be resolved or is not a field. Not able to get this fixed. searched most of SO and Google group. No perfect solution. I am running minSDK for 9 and target of 18. Can somebody help me out fix this up? Thanks! 回答1:

How to pass the Alarm value to Alarm Receiver

血红的双手。 提交于 2019-12-24 12:30:14
问题 I tried to develop a sample Alarm Application. I was searched Google and SC, most of the examples confusing me. I have done with my code, but why it failed to pass the alarm value to the Alarm receiver . Please help me. Thank you for your concern. Here is my code. public class ReminderFragment extends Fragment { Button buttonstartSetDialog; TextView txt_time; Context ctx; final static int RQS_1 = 1; public ReminderFragment() { } @Override public View onCreateView(LayoutInflater inflater,

EditText pops up TimePicker for Alarm/Reminder System

此生再无相见时 提交于 2019-12-24 11:43:23
问题 Is it possible to popup a TimePicker when an EditText is clicked/touched? I've tried looking for examples of this but I haven't found any. I want to use this time entered to set up an alarm, so it'd be great if someone could tell me how to do this and provide me of an example. I'd prefer it if the Time was in 24 hour format instead of 12 hour format. Thanks for any answers submitted. 回答1: I will give you some tips to achieve that. To show popup/dialog after EditText is clicked/touched you