android-alarms

BroadcastReceiver and AlarmManager Android

别说谁变了你拦得住时间么 提交于 2019-11-29 07:32:03
I am trying to use an alarm manager with BroadcastReceiver. I try to use the example given in Tutorial: System Services and BroadcastReceiver . but when I run the example after the end of the time the toast doesn't show up. the code is below: My main Activity: public class AlarmActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_alarm); } public void startAlert(View view) { EditText text = (EditText) findViewById(R.id.time); int i = Integer

Show Dialog using PendingIntent

旧城冷巷雨未停 提交于 2019-11-29 04:29:32
I am working on Calender Events reminder . There is no native Calender events reminder in Android so user install different calender apps. Now these apps can be different on reminding events like on reminder notifications can be shown. Now I want that I set an event programmatically in these event calender apps and on time reached not show any notification rather a pop up message will be shown with alarm like sound. At that I using a code from that site . Its working but it showing reminders in form of notifications. Here is code: OnReceive void doReminderWork(Intent intent) { Long rowId =

How to start a dialog (like alarm dimiss /snooze) that can be clicked without unlocking the screen

 ̄綄美尐妖づ 提交于 2019-11-29 02:14:29
I dont want to permanently bypass keyguard, just for that moment .For example when a alarm is raised (eg wake up alarm) i can dismiss /snooze it whithout unlocking screen .I want to achive the same behaviour.I want start a dialog which should be on top on locked screen. I can click button on dialog without unlocking .Is this possible ?If yes how? I dont want the following : private void unlockScreen(Context context){ Log.d("dialog", "unlocking screen now"); PowerManager powermanager = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)); WakeLock wakeLock = powermanager.newWakeLock

part-1 persistent foreGround android service that starts by UI, works at sleep mode too, also starts at phone restart

六眼飞鱼酱① 提交于 2019-11-29 02:01:27
Status:--- I equally accept Karakuri's and Sharad Mhaske's answer , but since Sharad Mhaske answer after the start of bounty , the bounty should go to him. Part-2 made: part-2 persistent foreGround android service that starts by UI, works at sleep mode too, also starts at phone restart In stack overflow , only one answer may be accepted . I see both answers as acceptable but one has to be chosen (I chosed at random). Viewers are invited to up/down vote answers/question to appreciate the effort! . I upvoted Karakuri's answer to compensate reputation. Scenario:--- I want to make the user click a

Programmatically turn screen on in android

别说谁变了你拦得住时间么 提交于 2019-11-28 21:38:07
I am developing an alarm application. From the main activity i set the alarm using broadcast. Then in onReceive in broadcast receiver i call activity that is enabling user to shut down or snooze the alarm...In that activity, in the beginning of onCreate i use this lines to turn screen on and unlock the device: final Window win = getWindow(); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); This works perfect on Samsung

Difference between setRepeating and setInexactRepeating of AlarmManager

懵懂的女人 提交于 2019-11-28 21:11:27
What are the parameters of the following: alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_FIFTEEN_MINUTES, alarmIntent); And of the following: alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, alarmIntent); What is the difference and also how are the two different in terms of functionality? Both examples schedule a repeating alarm that will send the given alarmIntent . On both cases, the first time it is sent will be immediate ( calendar.getTimeInMillis() returns the current time ). On

how to repeat alarm week day on in android

て烟熏妆下的殇ゞ 提交于 2019-11-28 19:01:50
I want to get alarm on monday to friday only. my code is here if (chk_weekday.isChecked()) { int day = calNow.get(Calendar.DAY_OF_WEEK); if (day == 2 || day == 3 || day == 4 || day == 5 || day == 6) { alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(), 1 * 60 * 60 * 1000, pendingIntent); } Have a Idea. please try this code. is successfully run in my apps if (chk_monday.isChecked()) { forday(2); } else if (chk_tuesday.isChecked()) { forday(3); } else if (chk_wednesday.isChecked()) { forday(4); } else if (chk_thursday.isChecked()) { forday(5); } else if (chk_friday

android repeat alarm for every monday or every tuesday

岁酱吖の 提交于 2019-11-28 13:02:43
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 every monday means, i found the milliseconds more to next monday date and i set an alarm, and its working

Alarm not working in android?

Deadly 提交于 2019-11-28 12:54:51
问题 I get stuck with something that , I guess , is very trivial. Basically I am scheduling alarm for a given moment in the future : Intent contentIntent = new Intent(this, AlarmReceiver.class); PendingIntent theappIntent = PendingIntent.getService(Main.this, 0,contentIntent, 0); Calendar calendar = Calendar.getInstance(); calendar.set(year, month, day, hour,minute); AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),

Alarm Manager issue in Android 6.0 Doze mode

南楼画角 提交于 2019-11-28 09:21:38
I've made an app that always worked until Android 6.0. I think it's the Doze feature that it's not allowing my Alarm to fire. I use sharedpreferences to handle the options: //ENABLE NIGHT MODE TIMER int sHour = blockerTimerPreferences.getInt("sHour", 00); int sMinute = blockerTimerPreferences.getInt("sMinute", 00); Calendar sTime = Calendar.getInstance(); sTime.set(Calendar.HOUR_OF_DAY, sHour); sTime.set(Calendar.MINUTE, sMinute); Intent enableTimer = new Intent(context, CallReceiver.class); enableTimer.putExtra("activate", true); PendingIntent startingTimer = PendingIntent.getBroadcast