alarmmanager

Android long running service with alarm manager and inner broadcast receiver

非 Y 不嫁゛ 提交于 2019-12-11 03:30:02
问题 I have a Service that uses a custom Connection class (extends thread) to a hardware controller. When the User prefers, I wish to maintain this connection on a permanent basis. I already have the code to handle when the Android device loses its internet connection, switches between wi-fi, etc. In order to stay connected, the controller requires that you speak to it within every 5 minutes. I currently, within the Connection class start a thread that runs in a while(), and checks the system time

Alarms not always triggering android

一个人想着一个人 提交于 2019-12-11 03:22:33
问题 *I am developing an Android application which triggers an alarm at certain time that the user selects. But the problem is this alarm is only triggered if the user sets it to a little amount of time from now. So it's like if the app is not running the alarm won't trigger. I already acquired a lock and also set the flags to keep the screen on. Sometimes when I set it to 15 minutes from now or something like that it works and then I try again and it doesn't. I also included the broadcast

Alarm Manager: cache Cleaner stops App

拜拜、爱过 提交于 2019-12-11 03:08:21
问题 i am making a simple alarm app and i want to show an activity after the given time has passed. here is the code i am trying. public void onReceive(Context c, Intent i) { Log.v("XXXX", S); Toast.makeText(c, S+" minute(s) passed", Toast.LENGTH_LONG).show(); Intent myIntent = new Intent(Main.this, AlarmBuzzer.class); myIntent.putExtra("ActivityName", activity_name); myIntent.putExtra("ActivityTime", S); //Optional parameters Main.this.startActivity(myIntent); } }; here if application is closed,

Android AlarmManager: how to find out the time remaining to trigger the PendingIntent

梦想的初衷 提交于 2019-12-11 02:54:54
问题 I am developing an alarm clock app. Below I have a function to set the alarm. But I want to know how to find the remaining time AlarmManager to trigger the PendingIntent. For example, it is now 10:00 am, and set the AlarmManager to trigger the PendingIntent 23:00, and the calculations we know that the PendingIntent will be called here 13 hours. But how to find out this time remaining? Sorry for my poor english. And I thank you for your attention String schedule = "23:00"; //example Calendar

alarmmanager 2 times

眉间皱痕 提交于 2019-12-11 02:39:30
问题 I have a BroadcastReceiver called AlarmReceiver that Toast s "alarm worked". I'm trying to set up a repeating PendingIntent to trigger AlarmReceiver at 5:45 and 17:30, but I see "alarm worked" after few seconds of starting the app. Why is the PendingIntent getting sent immediately? public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Calendar cal1 = Calendar

How to turn on screen when new notification is sent in the status bar?

牧云@^-^@ 提交于 2019-12-11 02:31:47
问题 This is my code in setting up a notification and it works: @Override public void onReceive(Context context, Intent intent) { category = (String) intent.getExtras().get("CATEGORY"); notes = (String) intent.getExtras().get("NOTES"); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( context).setSmallIcon(R.drawable.ic_launcher) .setContentTitle(category)

How to trigger an alarm only once in Android?

▼魔方 西西 提交于 2019-12-11 02:08:29
问题 I set an alarm when the user lands on a certain activity, which is triggered after a certain time. How can I check if this alarm has already been triggered or not, so that it doesn't get set again if the user goes back to this activity ? I can only prevent the alarm getting set again if it's already scheduled but not triggered with this : alarmIntent = PendingIntent.getBroadcast(context, requestCode, intent, PendingIntent.FLAG_NO_CREATE); if (alarmIntent != null) { // Alarm is already set

How to set repeating alarm using setExact and how to cancel the same?

匆匆过客 提交于 2019-12-11 00:35:58
问题 I am setting notifications using alarm manager and broadcast receiver. I have tried to use setInexactRepeating method of an alarm manager but it dose not raise alarms at exact time above API 19. So I got a suggestion to use setExact method and set alarms manually. I don't know how can I do this. Do I need to calculate dates for every week for a year? Also the alarms I am creating I want to delete the same if the event is deleted. How can I cancel this? Using cancel method I have tried to

How to Set up Alarm Same like Alarm App in Android?

房东的猫 提交于 2019-12-11 00:03:34
问题 I am trying to setup alarm outside of my app with little popup box. I made that popup box by using Activity.I been trying for a long time to setup alarm like Alarm app but i get failed in some situations. I am successful if i am exiting the app from the launch activity by using back button. But when i press home button the alarm keep working charm but with last used activity in background. I am not sure why this happening and i would like to know how i can make this work with out any activity

Android AlarmManager RTC doesn't pause while device is sleeping

允我心安 提交于 2019-12-11 00:01:48
问题 I wrote a little widget for Android devices. The widget uses AlarmManager to set recurring updates. I'm using the RTC clock for the AlarmManager . According to the documentation, if the device is sleeping, the RTC clock won't wake up the device and the next update will be when the device is woken. I have a log file for the widget which shows when it was updated. Even when I don't touch the device , I still see updates in the log file. Why is that? shouldn't the device be sleeping and thus my