android-alarms

Reminder Functionality

和自甴很熟 提交于 2019-11-30 21:38:52
问题 In my application i am trying to set reminder and alarm on that reminder but i am not able to do so. As i don't have complete and proper knowledge of how to set reminder, edit it and delete it. As i searched on google and what i got is not easy to understand for me. I tried a code as: Main.java Calendar cal = Calendar.getInstance(); java.util.Calendar; // add minutes to the calendar object cal.set(Calendar.MONTH, 4); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.DAY_OF_MONTH, 5); cal.set

AlarmManager not working properly

戏子无情 提交于 2019-11-30 20:13:30
I'm trying to create an alarm based application. I'm using AlarmManager . The thing is that it's not reliable at all. In some devices it works.. in other devices it works somethimes.. and in other devices it doesn't work at all. When I say that it doesn't work is that simply, alarms won't fire. For example, in my Xiaomi Mi4, if you turn off the screen, no alarm will fire. I have a testing Moto G and in that phone alarms use to work fine, but in OnePlus, alarms won't fire too. They simply are never called. Am I missing something? Does anybody know what am I doing wrong?? Thanks a lot for your

How to launch Alarm Clock screen using Intent in Android?

試著忘記壹切 提交于 2019-11-30 16:21:59
In my application, i want to add alarm using my App. So i want to launch the add alarm screen of the phone directly from my App. So how to launch it using Intent? The following code starts an AlarmClock activity: Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); i.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm"); i.putExtra(AlarmClock.EXTRA_HOUR, 10); i.putExtra(AlarmClock.EXTRA_MINUTES, 30); startActivity(i); You also need to use the following permission: com.android.alarm.permission.SET_ALARM See Android documentation here . Shayan Amani You should make an Intent. As the clock and alarm

AlarmManager when the phone is turned off - ANDROID

喜欢而已 提交于 2019-11-30 14:16:16
I'm doing an alarm System but i've a problem when the phone is turned off.. The alarm doesn't work.. I'm setting de alarm as follows: public void doIntents(Context context, long milis, Tratam trat){ cal=Calendar.getInstance(); alarmManager = (AlarmManager) context.getSystemService(Service.ALARM_SERVICE); cal.setTimeInMillis(milis); Intent intent = new Intent(context, OnAlarmReceiver.class); pendingIntent = PendingIntent.getBroadcast(context, trat.getId(), intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.set(AlarmManager.RTC_WAKEUP,milis ,pendingIntent); } The Alarm works Ok when the

Creating a Notification at a particular time through Alarm Manager

牧云@^-^@ 提交于 2019-11-30 14:15:59
问题 I am trying to create a notification at a particular time. Im creating a broadcast receiver and calling it through the AlarmManager. Problem is that the broadcast is not received and that I am not getting any notifications. Registering the Broadcast Receiver in the Manifest, <receiver android:name="com.example.android.receivers"> <intent-filter> <action android:name="com.example.android.receivers.AlarmReceiver" /> </intent-filter> </receiver> This is the Broadcast Receiver, public class

Android P Beta - AlarmManager Notifications not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 14:02:26
I'm testing my application on Android P beta release 4. My app's targetSdkVersion is 27 It has been observed that alarm manager notifications are not working as expected. I'm using below code to set the notifications - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { alarmManager.set(AlarmManager.RTC_WAKEUP, triggerAtMillis, AlarmIntentBuilder.buildPendingIntent(context, uri)); } else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { alarmManager.setExact(AlarmManager.RTC_WAKEUP, triggerAtMillis,

Creating a Notification at a particular time through Alarm Manager

情到浓时终转凉″ 提交于 2019-11-30 09:55:10
I am trying to create a notification at a particular time. Im creating a broadcast receiver and calling it through the AlarmManager. Problem is that the broadcast is not received and that I am not getting any notifications. Registering the Broadcast Receiver in the Manifest, <receiver android:name="com.example.android.receivers"> <intent-filter> <action android:name="com.example.android.receivers.AlarmReceiver" /> </intent-filter> </receiver> This is the Broadcast Receiver, public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context pContext, Intent pIntent)

Repeating Alarm for specific days of week android

百般思念 提交于 2019-11-30 07:12:16
In my application I have a functionality to trigger alarm in 4 senerios: Only once for a user chosen date and time Daily for chosen time Weekly according to chosen date and time User chosen custom days of the week I successfully implement the first 3 senerios by using the follow: Only once: Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, Integer.parseInt(date[0])); calendar.set(Calendar.MONTH, (Integer.parseInt(date[1])) - 1); calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(date[2])); calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time[0])); calendar.set

Android start running JobScheduler at specific time

ぃ、小莉子 提交于 2019-11-30 07:11:27
I want to start a JobScheduler at a specific time everyday , and finish it after 3 hours. I have the part of triggering the job every 20 min, and for 3 hours, but in JobInfo.Builder class there's no option for starting the job at an exact time. Going over the JobInfo.Builder class overview, there's nothing there that sets the time for starting a JobScheduler. Obviously, i don't want to run it for the whole day, and check that the time matches, this will drain more battery than needed, and is bad programing. I was thinking of making an alarm to run at the time i specify and would trigger this

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

 ̄綄美尐妖づ 提交于 2019-11-30 06:40:30
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 not afford to receive delayed alarms or dropped ones because the device is in Doze mode! I used the