alarmmanager

Create reminder in android app

孤街醉人 提交于 2020-01-06 14:18:31
问题 I am trying to create a weekly reminder in my app. For this I am using AlarmManager. Here is the code generating alarm pendingIntent = PendingIntent.getBroadcast(SettingsActivity.this, 1234567, new Intent(SettingsActivity.this, WeeklyReminder.class), 0); AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.SECOND, 30); long updateFreq = 30*1000;//24*60

Create reminder in android app

时光毁灭记忆、已成空白 提交于 2020-01-06 14:18:05
问题 I am trying to create a weekly reminder in my app. For this I am using AlarmManager. Here is the code generating alarm pendingIntent = PendingIntent.getBroadcast(SettingsActivity.this, 1234567, new Intent(SettingsActivity.this, WeeklyReminder.class), 0); AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.SECOND, 30); long updateFreq = 30*1000;//24*60

How to solve error “Unable to start activity ComponentInfo”?

一个人想着一个人 提交于 2020-01-06 08:21:08
问题 I have written a code for alarming phone for a particular time, and the alarm will stop after that period. I have tried running this code in emulator, and everything runs smoothly. But when I tried this to my HTC Desire HD (Android 2.3.5), the application gets force closed. Can someone tells me what happened??? public class RingerActivity extends Activity{ /** Called when the activity is first created. */ Button press; boolean tone = true; MediaPlayer mp; @Override public void onCreate(Bundle

How to solve error “Unable to start activity ComponentInfo”?

让人想犯罪 __ 提交于 2020-01-06 08:21:03
问题 I have written a code for alarming phone for a particular time, and the alarm will stop after that period. I have tried running this code in emulator, and everything runs smoothly. But when I tried this to my HTC Desire HD (Android 2.3.5), the application gets force closed. Can someone tells me what happened??? public class RingerActivity extends Activity{ /** Called when the activity is first created. */ Button press; boolean tone = true; MediaPlayer mp; @Override public void onCreate(Bundle

AlarmManager stops running

隐身守侯 提交于 2020-01-06 05:36:28
问题 I'm writing a program that should run every 10 minutes in the background. The code I have seems to work fine as long as I'm actively using my phone, but after a long period of time, say overnight, the process seems to stop on it's own. When my program is running as it should I can view it under the "cached process" on my device, but then it will stop showing in the list after awhile. I was reading about WakefulIntentService and was wondering if I need to use that. As I understand it, it will

Android alarm manager with multiple pending intents

扶醉桌前 提交于 2020-01-06 05:35:13
问题 So I have such app where you can create multiple journals and I want to set reminders for each journal. For example in one of the journals I set reminder to repeat every week on Tuesdays and Fridays and then in another journal I want to set different reminder on same days how can I do so that reminders wouldn't cancel each other? Because I cannot set one Alarm manager to repeat on different days I'm setting multiple alarm managers for each selected day with different requestCodes, but then if

local notification not repeating

你离开我真会死。 提交于 2020-01-05 09:13:20
问题 I need to show notification for completing registration to user in every 2 hrs , I have set it to few mins for testing , but my notification comes only once it never come again . Please suggest. My code for repeating task : public void createNotification() { Intent notificationIntent = new Intent(context, ShowNotification.class); PendingIntent contentIntent = PendingIntent.getService(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager am = (AlarmManager)

local notification not repeating

£可爱£侵袭症+ 提交于 2020-01-05 09:10:11
问题 I need to show notification for completing registration to user in every 2 hrs , I have set it to few mins for testing , but my notification comes only once it never come again . Please suggest. My code for repeating task : public void createNotification() { Intent notificationIntent = new Intent(context, ShowNotification.class); PendingIntent contentIntent = PendingIntent.getService(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager am = (AlarmManager)

periodically send location updates using fusedLocation API

只谈情不闲聊 提交于 2020-01-05 08:46:09
问题 Android programming is a brand new thing to me, i've been playing with android's location and i have a same issue, im going to send a periodic location updates to a server in background and i'm using the AlarmManager/LocationManager approach, set an alarmManager with a defined Interval then when the alarmReceiver is triggered it will get device's current location (using locationManager) and send it to the server on its onReceive method. i found out this FusedLocation as a great replacement as

Starting AlarmManager in Android (C#)

◇◆丶佛笑我妖孽 提交于 2020-01-05 03:50:30
问题 I saw and used this link: Creating And Scheduling Alarms Using AlarmManager In Android Now I have this code: namespace AlarmManage { public class MyBroadcastReceiver : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { Toast.MakeText(context, "Time Up... Now Vibrating !!!", ToastLength.Long).Show(); Vibrator vibrator = (Vibrator)context .GetSystemService(Context.VibratorService); vibrator.Vibrate(2000); } } } public void startAlertAtParticularTime() { //