alarmmanager

How do I stop playing sound by switching between toggle button?

血红的双手。 提交于 2020-01-17 12:18:15
问题 I have made an alarm clock and there I have used a toggle switch to start my alarm. What I want is as soon as the user click on the button again, it should stop the alarm (ring). Toggling between ON and OFF wil start and stop respectively. But right now, I am only able to start my alarm. In fact it never gets stopped. If I switch the button OFF the sound gets played even faster, that is very strange. How can I stop it? I have pasted the only part of code where I am assuming the problem occurs

Android : AlarmManager not start

◇◆丶佛笑我妖孽 提交于 2020-01-17 08:45:11
问题 I must create an AlarmManager that repeating every seconds, I use this code Intent in = new Intent(context,Tempo_Indietro.class); in.putExtra("id_widget", appWidgetIds[i]); PendingIntent pi = PendingIntent.getActivity(context, 0, in, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarm = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 1000, pi); but it don't start...why ?? 回答1: To start a Scheduled

AlarmManager not invoking the task?

☆樱花仙子☆ 提交于 2020-01-17 07:57:09
问题 I want to execute a auto-logout after 10 PM everyday in my application, for that that I have implemented a AlarmManager task but it is not invoking .For testing purpose I have given the other timing .(e.g calendar.set(Calendar.HOUR_OF_DAY,15); calendar.set(Calendar.MINUTE,59); calendar.set(Calendar.SECOND,30); ) AlarmManager Code: sign_in_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { hideKeyboard(LoginActivity.this); //implementation of auto

Why isn't my alarm going off? (android)

痞子三分冷 提交于 2020-01-17 07:30:51
问题 My alarm does not go off at the specific time or at all (I have tried setting it to one minute of current time). I have made sure that setAlarm() is going off because the log Log.d("asas", "adasd"); goes off. I do not know what is wrong, if you see how I can fix this please let me know. Thanks public void setAlarm(){ AlarmManager alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, DrawOverAppsService.class); PendingIntent alarmIntent =

Alarm Manager is triggered immediately in Android

三世轮回 提交于 2020-01-17 04:34:20
问题 Strangely, my Alarm Manger is calling the pending intent immediately, even though I have put a condition if the current time is greater than alarm time run one day later. I have alarm Manger to trigger everyday at 10PM. Intent startServiceIntent = new Intent(this, numbers.class); this.startService(startServiceIntent); Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(res.getString(R.string.hoursvalue))); //10 cal.set(Calendar.MINUTE, 0); cal.set(Calendar

Android AlarmManager.cancel() not actually cancelling alarm/PendingIntent

青春壹個敷衍的年華 提交于 2020-01-17 04:11:48
问题 Trying to cancel an AlarmManager alarm, isn't quite working. I create a PendingIntent like so: static PendingIntent makePendingIntent(int id, Bundle bundle) { Intent intent = new Intent(mContext.getApplicationContext(), mfLocalNotificationManager.class); if(bundle != null) { intent.putExtra(BUNDLE_ID, bundle); } return PendingIntent.getBroadcast(mContext.getApplicationContext(), id, intent, PendingIntent.FLAG_UPDATE_CURRENT); } Called from SendLocalNotification: public static int

Implementing an alarm every 5 days, code correct?

前提是你 提交于 2020-01-17 04:05:26
问题 I am trying to set an alarm every 5th day of the week and the 24th hour of that day. Here is the code i am using. Ive been reading over the Calendar and AlarmManager docs, a and here is what i have came up with. String alarm = Context.ALARM_SERVICE; //Alert for game covers am = (AlarmManager)context.getSystemService(alarm); calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_WEEK, 5); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar

AlarmManager Does not work when Activity in background

孤者浪人 提交于 2020-01-16 18:35:32
问题 In my App, I'm using AlarmManager for transmitting keep-alive every day once a day. I'm using the following code for starting athe AlaramManager Calendar calendar = DateUtils .getNextKeepAliveTime(keepAliveHours, keepAliveMinutes); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), ALARM_REQUEST_CODE, intent, 0); // PendingIntent.FLAG_UPDATE_CURRENT); // Get the AlarmManager service Log.d(TAG, "cal: " + calendar

AlarmManager Does not work when Activity in background

北慕城南 提交于 2020-01-16 18:35:09
问题 In my App, I'm using AlarmManager for transmitting keep-alive every day once a day. I'm using the following code for starting athe AlaramManager Calendar calendar = DateUtils .getNextKeepAliveTime(keepAliveHours, keepAliveMinutes); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), ALARM_REQUEST_CODE, intent, 0); // PendingIntent.FLAG_UPDATE_CURRENT); // Get the AlarmManager service Log.d(TAG, "cal: " + calendar

Using alarmmanager, Service is not being restarted after application being killed?

时光毁灭记忆、已成空白 提交于 2020-01-16 18:21:09
问题 I have made a simple example where a toast message will be shown after a time gap. I am using alarmmanager for scheduling a service from where the toast message will be shown. Now the problem is when the app is running it works properly, but when I close the app from task-manager the service is not getting restarted. Below is my service code public class AlarmService extends Service { @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand