android-alarms

Difference between setRepeating and setInexactRepeating of AlarmManager

半腔热情 提交于 2019-12-17 23:17:03
问题 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? 回答1: Both examples schedule a repeating alarm that will send the given alarmIntent . On both

Location Alarm for Android?

一世执手 提交于 2019-12-17 22:57:04
问题 When starting my app, several POI coordinates shall be added to the Android System. Some hours later, my app is closed and the user walks close to one of the POI he shall get notified e.g. through a status message. Is this the right approach for my scenario? Are there more things available in Android to achieve this? public void addProximityAlert (double latitude, double longitude, float radius, long expiration, PendingIntent intent) 回答1: Yes, you would use LocationManager and

Controlling the Alarm icon in status bar

邮差的信 提交于 2019-12-17 09:55:24
问题 This question relates to Android versions pre-Lollipop. For Lollipop API, check related question: Lollipop API for 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: From what I understand about the system, and what I've read in the past, it is controlled by the built in system alarm clock app. And 3rd party apps have no control over it on an unrooted device. There is no reason we should be able to

How to create Recurring of Alarm in Android After taking user input?

心已入冬 提交于 2019-12-14 03:08:18
问题 I am an android developer.I am making an application in which I have to take user input like 8:00,9:00,10:00 etc and I have to set alarm for 20 or 30 days for each time user enter .A user can enter two or three or any times the timings.I know there is a function alarm.setRepeating(AlarmManager.RTC,System.currentTimeMillis()+timeinminutes*60*1000,30*1000, pintent); But I have to set the alarm for ever or days entered by user .So can any body tell me .How can I do this . 回答1: the following code

Is there an easier way to use AlarmManager or to set real-time based alarms?

拜拜、爱过 提交于 2019-12-13 07:18:40
问题 It seems that the only way to time actions based on the actual elapsed time (as opposed to uptime, which stops when the device sleeps) is the AlarmManager. Is there an an easy way to do "wallclock"-based delayed exectuion, for example through an open-source wrapper around AlarmManager? For normal timing operations, you can use a handler, which is as easy as such a simple task should be: Implement the handler callback (no registration necessary) Instantiate a Handler Call

How to popup Alarm Message without any activity in background?

痞子三分冷 提交于 2019-12-13 06:32:20
问题 In my android i app i can alarm functionality and as well logout functionality. After setting my alarm time i am exiting the app by clicking the logout button. I am using ExitActivity.this.finish(); Intent intent1 = new Intent(ExitActivity.this,PinActivity.class); intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent1); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity

Send notification id to receiver while set alarm

断了今生、忘了曾经 提交于 2019-12-13 05:33:05
问题 I try to set an alarm depending user chocies while setting alarm i want to send that alarm's unique notification id to reciever.java. I want to get data by this id on reciever.java. I have a form with this form users are adding their pills and I'm saving every pill in different xml files for example pill1.xml pill2.xml. That saved pills have alarm and notification when alarm time came for example pill2.xml i will show pill2 datas in notirifacation bar. that code on bottom is how i create

Start service every 10 seconds

 ̄綄美尐妖づ 提交于 2019-12-13 05:19:58
问题 I have this android service that I'm trying to get information from every 10 sec, for testing purposes. But from what I can see service is starting but not getting update from it every 10 second. What can be the problem? Here is my service: public class SimpleService extends Service { private static final int NOVI_VESTI = 1; private static final int NOVA_OGLASNA = 2; private List<String> titles; @Override public IBinder onBind(Intent arg0) { return null; } @Override public int onStartCommand

How i can cancel an alarm after a period of time? | android

▼魔方 西西 提交于 2019-12-13 05:13:17
问题 hi i have an alarm here and i want a way to cancel it AFTER a period of time like a day for example or a week ,,, and thanks in advance ,, am = (AlarmManager)parent.getContext().getSystemService(Context.ALARM_SERVICE); //the title and the description of the notification Intent alarmintent = new Intent(parent.getContext(), Alarm_Receiver.class); alarmintent.putExtra("title",titlePills + dea22); alarmintent.putExtra("note",dea22); alarmintent.putExtra("NOTIFICATION_ID",String.valueOf

Start Service at specific time everyday by alarmanager dont work

荒凉一梦 提交于 2019-12-13 04:47:16
问题 I want to start a service at specific time everyday and then service launch notification every min, well service work fine alone but when its called by the alarmmanager nothing happens. Here alarm code: Calendar cur_cal = new GregorianCalendar(); cur_cal.setTimeInMillis(System.currentTimeMillis());//set the current time and date for this calendar Calendar cal = new GregorianCalendar(); cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR)); cal.set(Calendar.HOUR_OF_DAY, 20); cal.set