Receiver dynamically or in manifest?

by Manfred » Thu, 05 Mar 2009 20:50:23 GMT

Sponsored Links

I have dynamically registered a receiver in a class that extends
Service to inform for incoming sms.

this.registerReceiver(smslistener, new IntentFilter

It works, but sometimes, when the phone is longer not used and the
black-screen appears, my application does not notice incoming sms
until i use the phone again.
So for example, i sent a sms at 13:23 and the G1 got it also at 13:23
but in the Logfile the entry was made at 13:43 when i used the phone

I read in another article that its better for listening to incoming
sms to register the receiver not dynamically but in the manifest, then
it should work! But my problem is, if i register it in the manifest it
is running when the application starts, but i want that the user can
choose if incoming sms would be noticed.

So is there a way to register the receiver in manifest, but stop it
then dynamically and start it again? Or how could this be done??


Other Threads

1. Cursor.moveToFirst() is taking up a lot of time


Currently i'm working on a database system for some applications. I
need to do a lot of queries to load data from the database into the
application. After being amazed how much time it took to do these
queries on the database i found out that much time was consumed by
cursor.MoveToFirst(). This functions costs currently ~25% of all my
database action.

Does anyone know why this takes would take so long or does anyone know
a better solution to get to the first position of the cursor?

My code:

Cursor c = db.query(var1, var2, var3 .....);

int count = c.getCount();
for(int i = 0; i<count; i++){

The same problem occurs when i place everything in a while loop and
use only the MoveToNext() function. So i think that the problem must
be in positioning the cursor to the first position.

My code:
Cursor c = db.query(var1, var2, var3 .....);


Sublimity Mobile Software


2. Android 1.5 Spare parts Battery History does not display any data

Because the emulator doesn't have a battery?


Jeff Sharkey


3. Screenshots on AndAppStore

4. Problem of using switch_class for headset detection

5. Magic review

6. Bluetooth microphone activation

7. java libraries