alarmmanager

Android AlarmManager - Cancel from another Activity

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 16:26:34
问题 I have a Homework Planner application which I want to create an Alarm for to remind users of the homework the night before/at a certain time. I have an Activity called AddNewHomework which is where the user creates a new homework item and it is added to the database. This code is then called. Intent i = new Intent(this, AlarmNotificationReceiver.class); i.putExtra("title", title); PendingIntent pi = PendingIntent.getBroadcast(this.getApplicationContext(), (int) id, i, 0); AlarmManager mAlarm

AlarmManager is not working after app is closed? - Android

拟墨画扇 提交于 2019-12-06 15:41:15
I have a small problem about alarmmanager but I couldn't find a answer which fits to my code. My question is simple. I have a list of alarms which is set to future. While my app is running, I can recieve Notification. But when I close my app, It doesn't send notification to me and if I run my app again, past notifications can be seen in notification center. Here is my codes. In MainActivity.java I use this method which can take a Person List and sets alarm of each of Person. I run this method in onCreate() private void createScheduledNotification(List<Person> people) { for(int i = 0; i<people

Android Training Sample- Scheduler Sample- unable to stop alarm

纵饮孤独 提交于 2019-12-06 15:27:56
I am using the sample code(Scheduler.zip) available on the Android developer training website- http://developer.android.com/training/scheduling/index.html Here's the code:- MainActivity.java /* * Copyright 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS"

Periodically send data to server

本秂侑毒 提交于 2019-12-06 15:21:55
问题 I'm working on an app that receives data from Arduino through Bluetooth and sends that data to server. I've got this part working - once a user presses a button, I initiate BT connection, receive data and send it to server via Async Task: Thread for receiving data: private class ConnectedThread extends Thread { private final InputStream mmInStream; private final OutputStream mmOutStream; public ConnectedThread(BluetoothSocket socket) { InputStream tmpIn = null; OutputStream tmpOut = null; try

Android notifications multiple times

前提是你 提交于 2019-12-06 14:10:57
I have notifications that remind user to take the medicine. When I add new times for taking medicines, for example, at 9:00 pm and 9:01 pm, only last notification is active. Here is my code: AddTime.java: (part) Cursor cursor2 = sqdb.rawQuery("SELECT Name FROM Medicine WHERE _id = " + mId, null); while(cursor2.moveToNext()) { med = cursor2.getString(cursor2.getColumnIndex("Name")); } //med - Name of medicine String sql = "SELECT _id FROM Time WHERE mId = "+mId+" AND Year = "+year+" AND Month = '"+_month+"' AND Day = "+_numDay+" AND Week = '"+_week+"' AND Hour = "+_hour+" AND Minute = "+_min+"

set alarm notification between two specific date with particular day in android

≯℡__Kan透↙ 提交于 2019-12-06 13:08:53
问题 Hello friends i want to set notification with two specific dates like date1= 2014/10/30 date2=2015/10/30 and alarm should be notify at every 5th day(means date=5) of every month until date2 . how can i achieve this any idea Thanks in advances? 来源: https://stackoverflow.com/questions/26667762/set-alarm-notification-between-two-specific-date-with-particular-day-in-android

AlarmManager to fire notification at every 24 hours

。_饼干妹妹 提交于 2019-12-06 13:05:18
I am using AlarmManager() to fire Notification. I am setting it to fire at 10:30 AM of the morning and repeat at every 24 hours. My code is as follow. I have tested yesterday and the problem is that It was repeated around 4-5 times in just next 2 hours. I am not understanding that what is the problem. I want to fire it only at 10:30 AM of the morning and repeat at only 24 hours. Please help me solve the problem. I am calling this code on my app's Splash screen onCreate() My Code : Intent myIntent = new Intent(Splash.this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent

I need to implement Notification Reminder in my android app

送分小仙女□ 提交于 2019-12-06 12:41:28
问题 My Requirment: I want my application to show a reminder notification on every Friday @ 8 am I have used AlarmManager, BroadcastReceivers to implement my reminder notification. The problem I am getting is, When I set notification time using current system time and Add 2 minutes in it... It works perfectly when I use it in this way, it trigger my notification exactly after 2 minutes. But, When I use calender instance to set notification time at specific time of any day, it trigger my reminder

how to change ringer mode in background(Vibrate or Silent)

耗尽温柔 提交于 2019-12-06 11:24:16
I'm trying to write a program in which user can set time that will change ringer mode to vibrate or normal in background. When I set the start time it's working but at the end time it's not changing and device continuing vibrate mode. I just want, at the start time phone would be in vibrate and at end time phone would go back into the silent mode. MainActivity.java public class MainActivity extends Activity { private PendingIntent pendingIntent; private AlarmManager alarmManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

How to repeat an action every day in an Android app?

强颜欢笑 提交于 2019-12-06 11:04:25
I want to repeat an action every day; it must continue working even if the app is not running or the device has been restarted (rebooted). In my code I'm trying to show a TOAST message every 1 minute (as a test); it's working fine in the emulator but on a real device it doesn't work( i tried to do some changes to fixed as i see in some answers but still the same thing) MyReceiver class MyReceiver : BroadcastReceiver() { private val channelId = "com.medanis.hikamwahimam" override fun onReceive(context: Context, intent: Intent) { Log.i("TAG","/////////////////// SHOW NOTIFICATION NOW ///////////