android-alarms

How much delay is there when setting an inexact alarm via AlarmManager? [duplicate]

和自甴很熟 提交于 2020-01-11 10:20:08
问题 This question already has an answer here : How inexact is setInexactRepeating() for AlarmManager? (1 answer) Closed 3 years ago . When using AlarmManager to set an alarm, there could be a delay in which the alarm is triggered some time after the specified time unless you set an exact alarm. Is there any guarantee on what the range of this delay could be? I want to be a responsible developer and not use exact times if the delay is not more than, say, one minute. But I can't find any

Alarm manager don't work after some time

南笙酒味 提交于 2020-01-10 04:37:07
问题 This is my code. It works correctly, but after some time (about 1 hour) it doesn't work. Whats wrong? Thanks in advance. <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> public class Alarm extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "Alarm !!!!!!!!!!!!!", Toast.LENGTH_LONG).show(); } public void SetAlarm(Context context) { AlarmManager am=(AlarmManager)context.getSystemService

Show Dialog using PendingIntent

ぐ巨炮叔叔 提交于 2020-01-10 02:01:17
问题 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

How to check if AlarmManager is already working?

自闭症网瘾萝莉.ら 提交于 2020-01-06 15:53:27
问题 This qustion has been asked alot and i tried alot of the answer and didn't work so this is the most common one public void onClick(View v) { boolean alarmUp = (PendingIntent.getBroadcast(MainActivity.this ,0, new Intent(MainActivity.this,Notifications.class), PendingIntent.FLAG_NO_CREATE) != null); if (alarmUp) { am.cancel(pend); Intent alarmIntent = new Intent(MainActivity.this,Notifications.class); final PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0,

can anyone tell me how do I start mp3?

左心房为你撑大大i 提交于 2020-01-06 04:26:11
问题 I am making a project ,I need to start mp3 or any loud sound automatically when the toast "Fall Detected" appears for 20 second. public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { long curTime = System.currentTimeMillis(); if ((curTime - mLastShakeTime) > MIN_TIME_BETWEEN_SHAKES_MILLISECS) { float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; double acceleration = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) +

AlarmManager is blocking main thread

戏子无情 提交于 2020-01-04 13:37:32
问题 I have implemented an AlarmManager which calls a Service. The problem is that although I'm launching it in AsyncTask, it's blocking the main thread. This is the source of my AsyncTask: private class NotificationsServiceTask extends AsyncTask<Void, Void, Void> { private AlarmManager alarmMgr; private PendingIntent pi; @Override protected Void doInBackground(Void... params) { alarmMgr = (AlarmManager) LoginActivity.this.getSystemService(Context.ALARM_SERVICE); Intent serviceIntent = new Intent

Android, How to cancel an alarm? alarmManager.cancel not working

一世执手 提交于 2020-01-01 12:14:53
问题 I have an application where you can create 5 alarms where to be created are displayed in a ListView, and assume that when an element of listView the played alarm but should remove the item from the listview but the alarm is removed to reach the scheduled time always sounds. I have reviewed muchísmos tutorials and guides on how to remove the alarms but none helped me. To delete what I do is save the ID of each alarm in a sqlite database and when I give the alarm eliminiar what I do is I bring

Set an Alarm from My application

天涯浪子 提交于 2019-12-31 22:41:12
问题 I want to create an alarm object from my application. I am writing a To-Do application which will have an option to set an Alarm on the phone. I wanna set the Date and Time and also the Label for the alarm. Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); c.clear(); c.set(Calendar.YEAR, mYear); c.set(Calendar.MONTH, mMonth); c.set(Calendar.DAY_OF_MONTH, mDay); c.set(Calendar.HOUR, mHour); c.set(Calendar.MINUTE, mMinute); Intent activate = new Intent(this,

Alarm Clock application source code

依然范特西╮ 提交于 2019-12-31 18:43:12
问题 Is there a way to get the Alarm Application source code for customizing the existing default source code availble in Android 2.3 . 回答1: You can download the app from the Android github mirror. https://github.com/android/platform_packages_apps_alarmclock Or on the cyanogen mirror https://github.com/CyanogenMod/android_packages_apps_DeskClock And because, you are a nice guy, you are wondering: What is the license of that code? Glad you asked, because according to the Android documentation and

Alarm Clock application source code

邮差的信 提交于 2019-12-31 18:41:34
问题 Is there a way to get the Alarm Application source code for customizing the existing default source code availble in Android 2.3 . 回答1: You can download the app from the Android github mirror. https://github.com/android/platform_packages_apps_alarmclock Or on the cyanogen mirror https://github.com/CyanogenMod/android_packages_apps_DeskClock And because, you are a nice guy, you are wondering: What is the license of that code? Glad you asked, because according to the Android documentation and