Timer in an App

by chetan » Tue, 31 Aug 2010 14:03:09 GMT


Sponsored Links
 Hi All,
           I am creating an App in which i need to add a timer for
postpone the one event for 1 hr and start same event after 1 hr , so i
want to know how i can implement the same. Are there any Timer api's
and handling of them in android.

Thanks
Chetan Chauhan

--



Timer in an App

by Mark Murphy » Tue, 31 Aug 2010 15:56:01 GMT


 Use AlarmManager.



>


Sponsored Links


Timer in an App

by parag » Tue, 31 Aug 2010 19:49:14 GMT


 check this out

 http://justcallmebrian.com/?p=129 

its a very useful sample




> >



Timer in an App

by chetan » Thu, 09 Sep 2010 12:32:30 GMT


 Hi ,
        I have created an app with using Alarm Manager and added the 7
min alarm. Find the code below.

package com.example.ReminderTest;

import java.util.Calendar;

public class ReminderTest extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
        private String TAG="ReminderTest";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button btn=(Button)findViewById(R.id.Button01);
        btn.setOnClickListener(this);
    }

        @Override
        public void onClick(View v) {
                // TODO Auto-generated method stub
                 Log.d(TAG,"OnCLick Set tne time 1");
                if(v.getId()==R.id.Button01)
                {
                        /*Set the Timer*/
                     Log.d(TAG,"OnCLick Set tne time");
                         Calendar cal = Calendar.getInstance();
                         cal.clear();
                         cal.add(Calendar.MINUTE,7);


                         Intent intent = new Intent(this, 
AlarmReceiverTest.class);
                         intent.putExtra("alarm_message", "O'Doyle Rules!");
                         // In reality, you would want to have a static 
variable for the
request code instead of 192837
                         PendingIntent sender = 
PendingIntent.getBroadcast(this, 192837,
intent, PendingIntent.FLAG_UPDATE_CURRENT);

                         // Get the AlarmManager service
                         AlarmManager am = (AlarmManager) 
getSystemService(ALARM_SERVICE);
                         am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 
sender);



                }
        }
}


Now my question ,  would the set alarm  persist after reboot of
phone ?

Thanks
Chetan Chauhan





> > >



Timer in an App

by Kostya Vasilyev » Thu, 09 Sep 2010 15:23:52 GMT


 09.09.2010 8:32, chetan :
Now my question , would the set alarm persist after reboot of phone ? Thanks Chetan Chauhan
No, it won't. The way handle it is to implement code to receive BOOT_COMPLETED broadcast, and start the alarm (and perhaps the service) then. -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --



Other Threads

1. Testing a change on a G1 phone after modifying OpenCore ?

I am planning to change OpenCore slightly so that a local video file
that is currently being written (streamed through network) can be
played out. (my understanding: media player will seek the end of a
local file stored in an SD card )

Once I make a change in PVplayer included in OpenCore, can I test it
on a G1 phone? Otherwise, can I only do so in the emulator, or as a
standalone application (I saw some postings that OpenCore can be
compiled out of Android)?

My guess is G1 phone's firmware that contains the current Android OS
image ( compatible to SDK 1.0?) cannot be flushed out. For those
developers that develop a different device may have their testbed
circuit boards. In that case, they may be able to do whatever they
want.

I wonder how people edit, compile, and test their own code while
working with Android source code..

A newbie to Android, yet hoping to learn it quickly.
Hun
--~--~---------~--~----~------------~-------~--~----~

2. Will the G1 version of android ever see any more updates from Google?

I'm pretty sure we'll be getting the 'Cupcake' update since RC usually
stands for "Release Candidate" which basically means that the Android
OS isn't finished (incomplete bluetooth stack for example). As to
whether that update comes over the air or not is up to the Carrier (T-
Mobile) but alot of people will just manually upgrade.

On Jan 10, 5:14am, "Robert Steele" <robertnsteele....@gmail.com>






--~--~---------~--~----~------------~-------~--~----~

3. SQLite in WebView, is it possible??

4. wlan_loader service

5. Eclipse File Explorer doesn't work on G1

6. Change linear layout programmatically - problem

7. WebView: Need help with local file Urls in the browser