Android :: Setting An Alarm - Occur Repeatedly - Hence Using AlarmManager.setRepeating
Apr 10, 2010
In my android app, I'm setting an alarm that I want to occur repeatedly, hence using AlarmManager.setRepeating().
I don't want to keep track of whether the alarm is set myself (sounds like a bad idea that's prone to fail at some point), and there seems to be no API support for checking whether a particular alarm is already set for a given Intent.
Hence, I am pessimistically resetting the alarm each time my app activates:
alarmManager.cancel(pendingIntent);
...
alarmManager.setRepeating(..., pendingIntent);
Question: is calling setRepeating() idempotent i.e. do I need to explicitly cancel() any prior alarm or can I safely just call setRepeating() and be done with it?
View 1 Replies
Jun 27, 2010
I want for an event to fire every hour (at 5:00, 6:00, 7:00, etc...).
I tried with a persistent background service with a thread but it wasn't the right solution because of:
battery consumption
service termination, due to android memory management
So I'm trying with AlarmManager. It works if I set an alarm to fire in X seconds (using "set" method).
But how can I repeat an event (using "setRepeating" method) at the top of every hour, until the alarm is canceled?
View 1 Replies
View Related
Nov 18, 2010
If I use the AlarmManager to schedule an alarm (a PendintIntent which should be send), how can I identify that alarm later to cancel it? Can I cancel all alarms scheduled by my app?
View 1 Replies
View Related
Jan 18, 2010
Can we set a wma song as alarm ringtone? I set a wma as alarm ringtone but it is playing the different one but it is working fine with mp3.
View 2 Replies
View Related
Mar 5, 2010
I wanted to set the Gentle alarm application as my primary app when it is placed into the seidio multimedia station. It goes straight to the droid multimedia mode, then i have to switch over to the gentle alarm. I cant find any setting to make this happen.
View 4 Replies
View Related
Apr 10, 2009
I understand that userland apps on android cannot set the system clock. Wanting to know more about how the security mechanism is set up for the system I did some digging around in the source code.
/dev/alarm is opened R/W to set the system clock using SystemClock.setCurrentTimeMillis.
How the permissions work to determine whether or not an application has permission to set the clock.
I assume it's just a user level permission, and the write bit for /dev/ alarm is only enabled for the "system user" and not the "userland user" applications run under.
View 2 Replies
View Related
Aug 27, 2010
How can I put my own alarm sound? I mean music/song?
View 1 Replies
View Related
Jul 21, 2010
The calendar on desire is great, but it won't let me make entrants without setting an alarm...I don't want an alarm going off everytime its a member of my families birthday! Is there a calendar app I could get, that won't do this?
View 4 Replies
View Related
May 6, 2010
They all scare out of me when they go off, is there a way of setting a tune thats more calming in the morning
View 13 Replies
View Related
Sep 15, 2010
I have a repeating alarm setting, I have the activity being launched, the piece I'm missing is having this triggered after x minutes of inactivity.
I'm considering keying off of SCREEN_OFF in a service and then setting an alarm and canceling it on SCREEN_ON, does anyone have an intent or other suggestion for this. I've considering polling for tasks, all kinds of pieces but I'm stuck.
Requirement:
- App launches, alarm is set to relaunch app after 5 minutes, user exits/app exits after one minute
- alarm triggers, detects phone is in use, resets alarm to trigger in fives minutes
- if phone is idle relaunches app for one minute
View 1 Replies
View Related
Jun 12, 2010
I wanna add three layout in a TabActivity, but it was force closed when I ran it.
Here is the code:
import android.app.TabActivity;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class Test1 extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("egcquery").setIndicator("EGCQuery").setContent(R.layout.main1));
tabHost.addTab(tabHost.newTabSpec("PatientInfo").setIndicator("PatientInfo").setContent(R.layout.main2));
tabHost.addTab(tabHost.newTabSpec("Comp_Interp").setIndicator("Comp_Interp").setContent(R.layout.main3));}
View 1 Replies
View Related
Oct 12, 2010
There are a lot of Android SDK APIs where callback handlers are registered. For a concrete example, with MediaPlayer you can set an onCompletionListener callback. Will these callbacks be called from the main (UI) thread? If the answer is "it depends", then I'm looking for some general rules for what callbacks will be called from the main thread versus another thread. The SDK documentation doesn't seem to spell it out. (Maybe I missed it) It seems important to know, because if I'm guaranteed main thread callbacks, then I can skip some thread synchronization on data shared between different places in code. If I'm forced to be pessimistic out of ignorance, then I have to write extra synch block code and worry about deadlocks, data integrity, and reduced performance.
View 4 Replies
View Related
Jun 3, 2010
I am having an interesting problem and would appreciate any advice. My app uses WebView as its primary view. Using a javascript hook, it can launch the camera so the user can take a picture. The camera is launched using: Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
When the camera starts, it makes sense to use landscape mode, so the user naturally turns the phone on its side. After the user takes a picture, control returns to my launching Activity (actually, my Acitivity gets restarted because it usually gets destroyed to free up memory for the camera on my Moto Droid). When my WebView gets recreated, I restore its state from the Bundle I saved in onSaveInstanceState().
Now everything looks ok, except the phone is still in landscape mode. However, when the user turns the phone upright bringing back into portrait mode, my WebView takes up only half of the screen. Somewhere along the way, the scale of my WebView got lost. This seems like such a minor issue, but it is driving me crazy.
Does anyone have an idea why this might be happening? What is the correct way to preserve the scale of my WebView? I am hesitant to hard code any scale factors because what looks good on my device may not be the same for another.
View 8 Replies
View Related
Jan 9, 2010
After following some instructions on Diego Torres blog I am able to test my classes using the regular Eclipse JUnit test-runner, however I also want to be able to run my unit tests from within the emulated android environment. For now this should make no real difference since the classes I am working on do very basic numerical or networking tasks, but obviously anything which involves the UI or Android API specific functions can only ever be tested on the emulator.
I set up a new run configuration of type AndroidJUnitTest wich uses the ndroid.test.InstrumentationTestRunner, however whenever I fire up the test I get the following error in the console:
[2010-01-09 00:45:23 - Pal1]Uploading Pal1.apk onto device 'emulator-5556'....................
View 1 Replies
View Related
Mar 9, 2010
I tried several alarm clocks on my droid, and they all seem to have a problem. if I set alarms for 6:30, 6:41, and 6:52 am. Each with a different sound. If i snooze alarm 1, alarm 2/3 never goes off. i thought all 3 would be seperate, but it seems only 1 can be active at a time. unless im doing something wrong. this happens on the default alarm clock and, better alarm clock.
View 2 Replies
View Related
Jul 2, 2009
I am using Android SDK 1.5. I am developing an activity with multiple content views. It will call setContentView() with different viewgroup instance for different functionality. It contains a text input dialog popped up by an option menu item. I didn't specify anything for IME in mainfest.xml & EditText attributes. I found at first, the soft keyboard for the text input dialog will overlap on the activity content view. But after several content view switch (by calling setContentView() with different ViewGroup instance), the soft keyboard will resize the activity content view. Why this inconsistent behavior happens?
...........................
View 13 Replies
View Related
Jul 29, 2010
it's possible to hook process in Android? for example we can hook process in windows:"trap events that will occur, either in your own process or in other processes. By "hooking", you tell Windows about a function, filter function also called hook procedure, that will be called everytime an event you're interested in occurs"
View 1 Replies
View Related
May 25, 2010
I use Google Voice for all SMS notifications. I use the Gmail application for my email.Does anyone know of an application that will vibrate my phone at a certain interval, e.g., every 2 minutes, until I actually open my phone and acknowledge that I've received the notification?I would LOVE THIS! I used to have a phone that did this and it came in handy. I find that my Incredible's vibrations are a little light, and I often miss important texts when it's on vibrate.
View 18 Replies
View Related
Sep 7, 2010
My requirement is to draw a line on canvas for every second. I am able to draw the line but its clearing the previously drawn lines when I call myview.invalidate(). Now my question is how to draw a new line retaining all the previously drawn line on the same canvas.
View 5 Replies
View Related
Dec 8, 2008
I have the following problem: when i try to play a sound over and over again, it sometimes (actually most times) is not played.the documentation says that one should use the media player in the following sequence if a sound should be played several times: is this the wrong approach? is there a more performant way to reset the pointer in the sound sample so that it can be played from the beginning? i tried using mediaPlayer.seekTo(0); but it didn't help. Code...
View 2 Replies
View Related
Aug 11, 2010
How i can display custom error message before foreclose or Application not responding message will happen for an application.
Or
Can i display Custom message like "Please wait....." instead of Application not responding message.
View 1 Replies
View Related
Jun 10, 2010
I am adding a proximity Alert with an expiration of -1 (does not expire). I am testing using an Evo. The proximity Alert fires several times after entering the location and staying inside the location. I was thinking that the proximity alert should fire once when you enter the location and fire once when you exit the location. Should the proximity alert fire multiple times after you enter the location and stay inside of the location?
View 2 Replies
View Related
Oct 28, 2010
I am developing an app where a single activity is instantiated multiple times by itself. I guess you could think of it like a book where each activity is a page. At the end of the page (activity) the user presses a button to go to a new page. I fire off an Intent for the same Activity, but I push different data into the Bundle so that a different page is loaded. This works fine, and I like the fact that the user can back up to a previous point, but my question is whether this will eventually be a problem? What happens if this activity is instantiated 10 times, or 50, or 100? Will the device run out of memory, will GC come along and clean up old activities, or what? If GC does clean them up, what happens when the user presses Back and the previous Activity is no longer on the stack? Is it better to keep track of the user's path, finish() the activity, and override the Back button so that whether the user is moving forward or backwards, I only load a single Activity? Another approach I could take is to refresh all the data on the page so that it's still the same activity, but with new data. The Back button would not work as expected in this case.
View 2 Replies
View Related
Jul 20, 2010
I am currently setting an alarm to fire off a background service every 2 minutes in order to check my server for certain updates. Now if I start the app and my screen is on and not locked the phone plays the sound I need it to play and opens the activity. Thats great. But the way I need it to happen is if the screen is off and the phone locked I still need it to check every two minutes and I need it to play that sound and open the activity that is needed. This does not happen for some reason. Could someone explain to me why the alarm doesn't function when my app is not "running" (by this i mean the app is marked as a running process but not actually visible to the user) and the screen is off? The code for the timer is below: CODE:.............
View 4 Replies
View Related
Mar 10, 2010
I am using alarmmanager in my app. It works perfectly for Nexus One and wakes the phone up everytime the alarm fires. But for droid it seems that the phone doesn't wakeup, is there an extra setting on the phone which can prevent the phone from waking up?
View 22 Replies
View Related
Jun 14, 2009
alarms.set(AlarmManager.RTC_WAKEUP, getTime(), alarmIntent);
I have set a alarm,but now i want to delete it? how can i make it.
View 3 Replies
View Related
Feb 24, 2010
I think I'm reading some conflicting statements about the AlarmManager on the Android docs website. The following statements both exist on this page:
http://developer.android.com/reference/android/app/AlarmManager.html
[at the top]
"Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted."
- and -
[under setRepeating()]
"This alarm continues repeating until explicitly removed with cancel(PendingIntent)"
So, the question is, do I need to register a BootReceiver that re-sets my Alarms when the phone turns on. The first statement makes me think I do, but the second statement is worded in a way that would lead one to believe that it would live forever, unless a cancel() call on that Intent is called.
So, which statement do I believe or am I misinterpreting one of the statements? I suppose when the power is turned off or back on, Android itself could call the cancel() function on all alarms. I guess it would help if it said that after the second sentence.
View 2 Replies
View Related
Jul 4, 2009
Show me some sample code on how to use an AlarmManager in android.
I have been playing around with some code for a few days and it just won't work...
I need to trigger a block of code after 20 minutes from the AlarmManager being set.
View 1 Replies
View Related
Mar 3, 2010
I changed AlarmController.java in ApiDemo a little bit, so I want the alarm not to go off when the phone is sleeping by using AlarmManager.RTC.
CODE:.................
The receiver code is like below:
CODE:..............
I ran the modified app, but I still see many log messages as below after the phone wento sleep (the screen was black):
CODE:...............
This means the flag AlarmManager.RTC didn't work.
View 1 Replies
View Related
Apr 5, 2010
I have a AppWidget, after I delete it from HomeScreen it seems not stopping the AlarmManager attached with it. I have supported it with the AlarmManger, that call the ProviderImplementation class every 1 minute and in onReceive I put the code to call onUpdate. and in onDelete I explicitly stop the alarm, but it seems it is running continously and not stopping. any cure of it ?
I have stopped it with cancel(pendingintent) function.
View 2 Replies
View Related