android-alarms

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

人走茶凉 提交于 2019-11-27 16:23:59
问题 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 = (

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

自作多情 提交于 2019-11-27 15:00:02
问题 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

Service being re-Created by AlarmManager

坚强是说给别人听的谎言 提交于 2019-11-27 14:55:27
I have a fairly standard Service which I wish to trigger using an alarm. Here's the initiation section of the service: class MyService extends Service { private Context context; private AlarmManager alarmManager = null; private final String startReason = "com.stuff.myreason"; private final int REASON_NO_INTENT = 0; private final int REASON_ALARM = 1; private final int REASON_X = 2; // and so on. @Override void onCreate() { super.onCreate(); context = getApplicationContext(); alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); // do onCreate stuff } @Override int onStartCommand

Start AlarmManager if device is rebooted

我与影子孤独终老i 提交于 2019-11-27 12:24:28
In my app I want to run some code every day at a specific time using an AlarmManager . In the android documentation I found this: Registered alarms are retained while the device is asleep [...] but will be cleared if it is turned off and rebooted. And that is the problem. I want to run the code even if the user reboots the phone. If the user reboots the phone he currently has to relaunch my app to start alarms again. How can I prevent this? Is there a better mechanism I should use instead? Create Boot Receiver using following code : public class BootBroadcastReceiver extends BroadcastReceiver

how to repeat alarm week day on in android

拜拜、爱过 提交于 2019-11-27 12:08:05
问题 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. 回答1: 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

Samsung “App optimisation” feature kills background applications after 3 days

旧城冷巷雨未停 提交于 2019-11-27 08:49:23
We are currently developing an Android app that is a fitness-tracker application. It runs constantly in the background, and it works fine on most devices, but we've been having issues with the application dying completely on some Samsung devices. After some investigation, it seems like some Samsung devices has a completely custom "App Optimisation" feature ( http://forums.androidcentral.com/samsung-galaxy-s6/599408-app-optimisation-after-updating.html ), which is basically a (very) primitive version of the Doze feature that exists in later versions of Android which basically just murders apps

Scheduled alarm never calls receiver class

杀马特。学长 韩版系。学妹 提交于 2019-11-27 07:23:21
问题 I'm trying to set an alarm to fire every 5 minutes. This is the code for setting the alarm : @Override public void scheduleAlarmManager() { Timber.i("After SignIn sets AlarmManager"); // broadcast Intent intent = new Intent(this, PatientAlarmReceiver.class); intent.setAction(PATIENT_START_ALARM_ACTION); PendingIntent pendingIntent = PendingIntent.getBroadcast( this, REQUEST_CODE, intent, 0); // and set alarmManager AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE);

Running task periodicaly(once a day/once a week)

半世苍凉 提交于 2019-11-27 03:55:34
I want to run some task (i.e. get my web site news page) periodically (once a week/ a day), even if my application is closed. Is it possible? Graham Smith Yes it is, you need to look at the AlarmManager to setup a reoccurring "Alarm". This is better for battery life on the device, as unlike a service it does not run constantly in the background. The Alarm triggers a broadcast receiver which will execute your custom code. As a final note - there are enum values for the timing of the Alarm including daily, half daily and many more although you can just set an actual value. A good example can be

Alarm Manager issue in Android 6.0 Doze mode

♀尐吖头ヾ 提交于 2019-11-27 02:57:46
问题 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);

Lollipop API for controlling the Alarm icon in status bar

人走茶凉 提交于 2019-11-27 02:49:03
问题 This is a Lollipop-specific question , since the API has changed. To find out how to do this on earlier versions, see related question: Controlling the Alarm icon in status bar I would like to know how to turn on / off the system Alarm icon in the status bar as shown in this image: Timely Alarm Clock controls this icon on Lollipop as of release 1.3. Prior to that release, the code was using private APIs as detailed in the related question. The new technique they use works on an unrooted Nexus