Execute tast at specific time

Put your problem here if it does not fit any of the other categories.

Execute tast at specific time

Postby mapiko » Thu Apr 07, 2011 7:49 am

Hello.

I have application running in activity. In want to create background service that will start some activity (playing sound) at pre arranged time (user will define it in UI)

What do you suggest? Service that checks time? or has andoid something more "programmer" friendly.

ps: will pay few usd via paypal for solution!
mapiko
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat May 15, 2010 5:19 pm

Top

Re: Execute tast at specific time

Postby strider2023 » Thu Apr 07, 2011 11:10 am

You can check it by running a thread in the background....
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Re: Execute tast at specific time

Postby imbroken » Thu Apr 07, 2011 11:24 am

Hi, you could use the AlarmManager. You can set events at a specific time and also if they are repaeting or not. You are free to start an service (for playing sound) or start an activity.
Just have a look at Alarmmanager and PendingIntens. Its not that hard.
imbroken
Senior Developer
Senior Developer
 
Posts: 131
Joined: Thu Jan 06, 2011 6:57 pm
Location: Germnay

Re: Execute tast at specific time

Postby mapiko » Thu Apr 07, 2011 11:25 am

I see. Alarmmanager can execute wanted task? like playing audio?

do you have any examples? thank you
mapiko
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat May 15, 2010 5:19 pm

Re: Execute tast at specific time

Postby imbroken » Thu Apr 07, 2011 11:30 am

Yes, if you would like to play a sound the alarmmanager should start an service so that it's not blocking the UI-Thread. Im at work right now, i can give you an example this evening, but google might help you sooner :)
imbroken
Senior Developer
Senior Developer
 
Posts: 131
Joined: Thu Jan 06, 2011 6:57 pm
Location: Germnay

Re: Execute tast at specific time

Postby mapiko » Thu Apr 07, 2011 11:37 am

I see. But can alarmManager exectue my own task (let say start service). Can you do this with alarm manager?

thank you
mapiko
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat May 15, 2010 5:19 pm

Top

Re: Execute tast at specific time

Postby imbroken » Thu Apr 07, 2011 11:49 am

of course you can
imbroken
Senior Developer
Senior Developer
 
Posts: 131
Joined: Thu Jan 06, 2011 6:57 pm
Location: Germnay

Re: Execute tast at specific time

Postby mapiko » Thu Apr 07, 2011 12:03 pm

wow would love to see an example. did google it. Not much luck.

can you write me: matej.pikovnik@gmail.com
mapiko
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat May 15, 2010 5:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 32 guests