alarm

why in the API Demo's AlarmService_Service.java, it says“just sleep for 30 seconds” instead of 15 seconds?

空扰寡人 提交于 2019-12-11 15:32:56
问题 I just looked through the AlarmService sample in the Android API Demo(API 8). When the AlarmManager in the AlarmService.java file use setRepeating() method to schedule the alarm, the service will create a new thread in the AlarmService_Service.java file. My question is: In the run() method of the mTask Runnable object, why it says "we will just sleep for 30 seconds."? My understanding is: the thread starts, and it waits/sleeps for 15 seconds(NOT 30 seconds), then this thread will be stop by

Android: Alarm not firing to update Widget from Service

南楼画角 提交于 2019-12-11 14:04:34
问题 I have created a widget to display the current date which refreshes every 5-10 seconds (Will be increasing the duration later). Created an alarm in the onUpdate method to create the intent for the service. Created an onReceive method extending broadcast receiver) to start the service which in turn updates the widget with the date. When I invoke the widget onReceive fires initially and displays the date. After that the alarm doesn't fire. 1) Am I right in including an onReceive method and

Android repeating alarm not repeating correctly

老子叫甜甜 提交于 2019-12-11 10:25:11
问题 I have an alarm that I am wanting to repeat around every 5 minutes. For testing purposes, I have it set to repeat once every 5 seconds instead, as such: AlarmManager alarmManager = (AlarmManager)getActivity().getSystemService(getActivity().ALARM_SERVICE); Intent intent = new Intent(getActivity(), CoordinateAlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getService(getActivity(), 1, intent, 0); int repeatSeconds = 5; alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,

Android: Alarm starts at wrong time

房东的猫 提交于 2019-12-11 09:55:14
问题 On some devices (even on some that, at least according to the manual, do not have a battery saver in the system, and the customers deny they installed one) the system broadcasts the Alarm Intent several hours later , only at the moment when the user switches the device on. If the users set the alarm in a few minutes, it works. If it is set in a few hours, it might work, might be off by a few minutes or hours, most likely the latter. This is getting on my nerves, as I always get the complaints

How do I set an alarm to terminate an EC2 instance using boto?

谁都会走 提交于 2019-12-11 08:23:33
问题 I have been unable to find a simple example which shows me how to use boto to terminate an Amazon EC2 instance using an alarm (without using AutoScaling). I want to terminate the specific instance that has a CPU usage less than 1% for 10 minutes. Here is what I've tried so far: import boto.ec2 import boto.ec2.cloudwatch from boto.ec2.cloudwatch import MetricAlarm conn = boto.ec2.connect_to_region("us-east-1", aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY) cw = boto.ec2

Android Clock App Set Alarm

梦想的初衷 提交于 2019-12-11 06:37:31
问题 I need to know if this is possible, and if it is, how I should proceed. I'd like to make an app that will create a repeating alarm within the stock Android Clock App. It should go off at 8am each morning and should only take one button to activate within my app. Thanks in advance 回答1: Try this: public void createAlarm(String message, int hour, int minutes) { Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM) .putExtra(AlarmClock.EXTRA_MESSAGE, message) .putExtra(AlarmClock.EXTRA_HOUR,

Android service not restarted

谁说胖子不能爱 提交于 2019-12-11 04:52:56
问题 I have a service that tracks the user locations. It doesn't have to run 24x7 but it should run for the duration of the trip. Following are the things that I have implemented till now to ensure it's continuous functioning : started service as foreground used "START_STICKY" started an alarm which checks every 10 mins if service is running. If not it starts service. Despite of all these measures, for some devices(like MI 3w) service gets killed within 10 mins and doesn't restart at all(not even

Accessing and setting iPhone's alarm / User alert on timed interval

末鹿安然 提交于 2019-12-11 03:56:17
问题 Are there any way to access or set iphone's alarm? Im assuming if this isn't available, the only other way is push notification to alert the user on a timed interval. Any ideas? 回答1: There are no public API's for accessing the calendar or alarms. 来源: https://stackoverflow.com/questions/822490/accessing-and-setting-iphones-alarm-user-alert-on-timed-interval

Play Alarm Sound when app is not running IOS

故事扮演 提交于 2019-12-11 00:12:09
问题 I have been working on IOS alarm app. Where i will create an alarm in the app. So i need the alarm to work as "Clock" app work in IOS. When the alarm time reaches and the app is not running. The alarm sound will play and user can stop it by clicking Cancel or snooze.. 回答1: For the alarm you need to use UILocalNotification You can set schedule for alarm withing the app like following: - (void)scheduleLocalNotificationWithDate:(NSDate *)fireDate { UILocalNotification *localNotification = [

How to Set up Alarm Same like Alarm App in Android?

房东的猫 提交于 2019-12-11 00:03:34
问题 I am trying to setup alarm outside of my app with little popup box. I made that popup box by using Activity.I been trying for a long time to setup alarm like Alarm app but i get failed in some situations. I am successful if i am exiting the app from the launch activity by using back button. But when i press home button the alarm keep working charm but with last used activity in background. I am not sure why this happening and i would like to know how i can make this work with out any activity