android.intent.action.TIME_TICK - Has anyone used it?

by simonc » Wed, 01 Apr 2009 19:41:49 GMT


Sponsored Links
 I'm trying to get an application / reciever / anything that can
perform a task once every minute. I'm trying to use the intent-filter
"android.intent.action.TIME_TICK" which, in theory, sends an Intent
message every minute.

Does anyone have any code that uses the
android.intent.action.TIME_TICK intent? I can't seem to get it to send
the intent to my application and I can't find anything much on the
internet. Has anyone used it successfully?

I have a manifest.xml as below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
      package="xx.xxx.xxxxxxx"
      android:versionCode="2"
      android:versionName="2.0.0">
    <uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.SET_TIME_ZONE" /
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".xxxApp"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver android:name=".xxxRecvr"
            android:process="xxx.xxx">
            <intent-filter>
                <action android:name="android.intent.action.TIME_TICK"/
                <action
android:name="android.intent.action.TIMER_TICK"/>
            </intent-filter>
        </receiver>
    </application>
    </manifest>
--~--~---------~--~----~------------~-------~--~----~



android.intent.action.TIME_TICK - Has anyone used it?

by Mark Murphy » Wed, 01 Apr 2009 19:45:34 GMT


 


That seems harsh for battery life, but maybe there's more to this that
I'm not privy to.


Per the documentation:

"You can not receive this through components declared in manifests, only
by exlicitly [sic] registering for it with Context.registerReceiver()."

In your case, you are trying to receive this through a manifest-declared
receiver, which will not work.

Either switch to a registerReceiver() implementation, or use AlarmManager.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android App Developer Training:  http://commonsware.com/training.html 

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


Sponsored Links


Other Threads

1. Aksesoris untuk Magic (Screen protector,dll

Pagi semua, numpang nanya lagi ya :)

Rencananya hari ini saya mau jalan-jalan sekalian nyari aksesoris buat
si Magic. Rencana mau nyari screen protector sama silicon case. Ada
yang udah punya dan recommended? Merknya apa ya & belinya di mana?
Terus untuk screen protector katanya yang bagus yang anti-glare yah.
Kalau udah pakai screen protector nanti apakah sensitivitas touch
screen jadi berkurang??

Terima kasih. Salam android!


-- 
/**
 * @Name Rayhan
 * @GTalk saviourcat
 * @Yahoo md_ray
 * @Twitter md_ray
 * @SentFrom web
 */

--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:
 

2. java.util.prefs.Preferences doesn't "work" on device?

Hi!
My simple app needs to permanantly save its state before being
destroyed.
I use something like this:
private static final Preferences prefs = Preferences.userNodeForPackage
(WordChoice.class);

Now it seems that after experimenting a while on my g1 device, it
seems that preferences are sometimes cleared when the application
stops, from my experience this happens at random and there is a
roughly a 50% chance that preferences will be cleared.
This does not happen in the emulator, and certainly should not in the
Java world as far as I know since preferences are permanent type of
storing data.

Is there a way to use java.util.prefs.Preferences on Android platform
without risking clearing the prefs every time the app is stopped? I
don't want to use a file or database.

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

3. Problem to count number of days between Two dates...

4. Start judging ADC2 Apps

5. Problem sending special signs through TCP/IP to Android Phone

6. Computational cost of calling getReadableDatabase or getWriteableDatabase?

7. Question about GoogleSearch.apk and "android.process.acore"