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. Advertising Secrets

Page Rank counts the number of links coming to your site from other
sites. The theory is this means your site is more respected, and more
useful, than others. It also puts an emphasis on older sites -
therefore links from sites that themselves have a high pagerank and
age will effect yours more beneficially.

http://advertising-moneybizhome.blogspot.com/

-- 

2. OS Updates from Cell Provider Only?

It appears as though the only way to get OS updates is via my cell
phone company, is that correct?  It's not like a phone where you plug
it in to your PC and update on your on terms?

If so that is very concerning.

-- 

3. Nexus.02, Can you hear me now?

4. Change item in Listview after clicking

5. Best practise for storing app. Configuration

6. dex.jar not loaded from SDK folder

7. How to manually install APK on real phone?