im trying to ACTION_TIME_TICK

but

when i register it to the reciver it is not being called
any ideas ?

here is the manifest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="learn.Class_01"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name="Chepter_01" android:label="@string/
app_name">
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />

<action android:name="android.intent.action.TIME_TICK"></action>
</intent-filter>
                </activity>
                        <receiver android:name=".MySMSMailBox" >
                                <intent-filter>
                                    <action
android:name="android.provider.Telephony.SMS_RECEIVED" />
                                <action 
android:name="android.intent.action.TIME_TICK"></action>
<action android:name="android.intent.action.TIME_SET"></action>
<action android:name="android.intent.action.TIMEZONE_CHANGED"></
action>
</intent-filter>
                        </receiver>
    </application>
    <uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-
permission>





On May 4, 1:02 pm, kaloer <[email protected]> wrote:
> Thank you very much! That's exactly what i was looking for.
>
> On 4 Maj, 16:32, MrSnowflake <[email protected]> wrote:
>
>
>
> > I believe you are updating you clock every minute. If that's true, you
> > could(/should?) use the ACTION_TIME_TICK intent (http://
> > developer.android.com/reference/android/content/
> > Intent.html#ACTION_TIME_TICK). Register to it from you Activity and
> > your BroadcastReceiver will be called every minute.
>
> > On 4 mei, 14:38, kaloer <[email protected]> wrote:
>
> > > Hi,
>
> > > I have a method in my application which updates a clock. But what is
> > > the best way to run the method so that it automatically updates the
> > > clock?
>
> > > Should i use a Timer (i have heard, that it does not work very well in
> > > android) or what should i use?
> > > I will be glad if you could please post a simple example :-)
>
> > > Currently the part of my code that contains the thread looks like
> > > this, but it does not work (I don't get an exeption, but it simply
> > > does not run the updateTime() method.) :
>
> > > public class NightClock extends Activity {
>
> > >         private final ScheduledExecutorService scheduler =
> > > Executors.newScheduledThreadPool(1);
> > >         ScheduledFuture<?> updateHandle;
>
> > >     /** Called when the activity is first created. */
> > >     @Override
> > >     public void onCreate(Bundle savedInstanceState) {
> > >         super.onCreate(savedInstanceState);
> > >         setContentView(R.layout.main);
> > >         Calendar cal = Calendar.getInstance();
> > >         updateTime();
> > >         long toTimerStart = ( 60 - cal.get(Calendar.SECOND) ) * 1000;
> > >         Runnable mUpdateTimeTask = new Runnable() {
> > >                         public void run() {
> > >                                 updateTime();
> > >                         }
> > >         };
>
> > >         updateHandle = scheduler.scheduleAtFixedRate(mUpdateTimeTask,
> > > toTimerStart, 1000, TimeUnit.MILLISECONDS);
>
> > >     }
>
> > > Thank you very much!
>
> > > //Kaloer- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to