Yeah I figured out how to hold the wake only if I need to notify the user. It 
seems everything worked w/o a wake lock except updated my listview and playing 
the sound. So once if I have to go into the activity I start the wakelock 
otherwise nothing happens. Thanks for the reply!

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Kostya Vasilyev
Sent: Tuesday, July 20, 2010 3:28 PM
To: [email protected]
Subject: Re: [android-developers] Help With AlarmManager Please?

Tommy,

You are not going to hold the wakelock the entire time the phone is 
asleep, are you? That would drain the battery pretty fast.

Your alarm already wakes the application up, hopefully you can hold the 
wake lock just for the duration of whatever periodic task the app needs 
to perform.

-- Kostya

20.07.2010 23:12, Tommy пишет:
> AH-HA after a little more digging and research into alarm manager I found
> out I wasn't setting the wakelock!
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Tommy
> Sent: Tuesday, July 20, 2010 1:55 PM
> To: Android Developers
> Subject: [android-developers] Help With AlarmManager Please?
>
> Hi everyone,
>
> 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:
>
> int alarmType = AlarmManager.RTC_WAKEUP;
>                       long timeToRefresh = System.currentTimeMillis() +
> (120 * 1000);
>                       alarm.set(alarmType, timeToRefresh, alarmIntent);
>
>
> The intent code after I set the alarm:
> if(validAlert == true){
>                               Intent startIntent = new Intent(this,
> SevereAlert.class);
>       
> startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>                               startActivity(startIntent);
>
>                       }
>
> I set valid alert a little above.
>
> Once the intent gets called to open it is suppose to play a sound and
> display a listview which like I said works correctly if I start the
> service from my app but doesn't do a darn thing if the screen is not
> on.
>
> Thank you for your help and your time,
>
> Tommy
>
>    


-- 
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to