alarmmanager

Android: AlarmManager used to call a Service to notify the user

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Edit Adding this line in my manifest solved my problem (the Service is well created). <service android:name=".TimersService" > Post I'm currently trying to implement alarms to notify the user that a countdown has finished. I have a method createAlarm() that adds a new Alarm through an AlarmManager . This method is currently called inside a Fragment. It looks like this: private final void createAlarm(String name, long milliInFuture) { Intent myIntent = new Intent(getActivity().getApplication(), TimersService.class); AlarmManager alarmManager

Delete alarm from AlarmManager using cancel() - Android

匿名 (未验证) 提交于 2019-12-03 08:30:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to create and delete an alarm in two different methods which are both called at different moments in the application logic. However when I call AlarmManager's cancel() method, the alarm isn't deleted. Here's my addAlarm() Method : AlarmManager alarmManager = ( AlarmManager ) mContext . getSystemService ( Context . ALARM_SERVICE ); Intent intent = new Intent ( PROX_ALERT_INTENT ); intent . putExtra ( "ALERT_TIME" , alert . date ); intent . putExtra ( "ID_ALERT" , alert . idAlert ); intent . putExtra ( "TITLE" , alert .

setAlarmClock not exact in android marshmallow

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use setAlarmClock method of Alarmmanager for do alarm clock application. When I set alarm clock from 6.00 AM and alarm in 6.01 AM . It delay and not exact. Code when setAlarmClock . Intent intent = new Intent(getBaseContext(), AlarmReceiver.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.putExtra(AppConstant.REMINDER, note.convertToString()); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), note.getId(), intent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager = (AlarmManager

Android Alarm manager working, but delayed

风流意气都作罢 提交于 2019-12-03 07:37:44
I would like to make a delay(10 min) for user then after it, user can edit something. to do this,I created a setAlarm function : public void setAlarm(Context context,int user,int time) { AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, sef_time.class); intent.putExtra(ONE_TIME, Boolean.FALSE); PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0); am.set(AlarmManager.RTC, 1000*60*time , pi); } everything works fine, but my alarm manager has a delay. for example: setAlarm(.....,int 10); It has a delay : 00: 10 :

AlarmManager: how to schedule a daily alarm and deal with time changes

纵然是瞬间 提交于 2019-12-03 06:03:30
I need to set up an alarm daily at a given hour. I'm programming the alarm using AlarmManager.RTC_WAKEUP , so it uses the system time as reference. I'm setting the alarm to first execute at the desired hour, then to repeat daily: alarmManager.setRepeating( AlarmManager.RTC_WAKEUP, getTimestampToday("12:00"), AlarmManager.INTERVAL_DAY, pendingIntent ); The getTimestampToday method returns a long timestamp for today at the desired hour. It does so by obtaining the local date for today, then setting the desired hour, finally converting it back to a timestamp (which is UTC based). The problem here

List of Android task killers

て烟熏妆下的殇ゞ 提交于 2019-12-03 03:58:46
I am trying to do a list of Android task killers that are installed by default on the operating system. The problem is that Android is modified by the phone's manufacturer and it is hard to keep up with what everyone is doing. So far I have found this: Smart manager - On Samsung phones. Could not call alarm manager but you can avoid this if your package name contains "alarm" or "alert" Doze - On Android 6. should not interrupt the app but it may delay alarm manager or network processes(especially if your app is not active and your phone is not charging). Xiaomi , AutoStart . If AutoStart is

Set an Alarm from My application

久未见 提交于 2019-12-03 03:31:52
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, alaram.class); AlarmManager alarams ; PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,

Android 8.0 Oreo AlarmManager with broadcast receiver and implicit broadcast ban

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have critical reminders that are set via the Alarm Manager (It should function the same way as an alarm clock application). Previously I had the following in my Android Manifest: <receiver android:name="com.example.app.AlarmReceiver" > <intent-filter> <action android:name="${packageName}.alarm.action.trigger"/> </intent-filter> </receiver> The broadcast receiver: public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive( final Context context, final Intent intent) { // WAKE LOCK // BUILD NOTIFICATION etc... } }

How to fix “process is bad” error for an Android Widget?

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have developed an Android Widget, and it was working fine. I added some extra functionality and pushed an update through the Android Market. Now people are complaining that it doesn't work anymore. The error I see in the logs is: 07-14 10:33:44.016: WARN/ActivityManager(78): Unable to launch app ... for broadcast Intent { act=android.appwidget.action.APPWIDGET_ENABLED cmp=... }: process is bad 07-14 10:33:44.026: WARN/ActivityManager(78): finishReceiver called but none active 07-14 10:33:44.026: WARN/ActivityManager(78): Unable to launch

How to Schedule Notification in Android [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: How to schedule a task using Alarm Manager 4 answers I'm trying to set notification for a time in the future. I have the code for creating a notification but I can't find an option to schedule it. How can I schedule notifications? 回答1: You need to use PendingIntent and BroadCastReceiver for this - public void scheduleNotification(Context context, long delay, int notificationId) {//delay is after how much time(in millis) from current time you want to schedule the notification NotificationCompat