Receiver dynamically or in manifest?

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


Sponsored Links
 Hi!

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

Code:
this.registerReceiver(smslistener, new IntentFilter
("android.provider.Telephony.SMS_RECEIVED"));

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
again.

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??

Thanks
manfred
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to implement onKeyDown() for KEYCODE_BACK

Hi,

I want to show some alert message when some one clicks on back button.

Actually I am using it in a class which extends TabActivity.

I implemented the kode as

public boolean onKeyDown(int keyCode, KeyEvent event)
        {

                System.out.println("(onKeyDown) is called in
RadioChannelsInfo.java");
                System.out.println("(onKeyDown) is called in
RadioChannelsInfo.java");
                System.out.println("(onKeyDown) is called in
RadioChannelsInfo.java");
                System.out.println("(onKeyDown) is called in
RadioChannelsInfo.java");
                System.out.println("(onKeyDown) is called in
RadioChannelsInfo.java");
                System.out.println("keyCode ->"+keyCode);
                System.out.println("event"+event);


                showDialog(DIALOG_YES_NO_MESSAGE);


                return true;
        }


it shows the dialog message when I click on right and left keys of the
mobile (emulator), but when I click on up, down and back button.

I want the dialog message should up when we click on keypad's back
button.

How should I do?

Can any one please help me?

Thanks,
Manoj.
--~--~---------~--~----~------------~-------~--~----~

2. ADC Top 10 Winner Looking for New ADC 2 Teammates

Our team, Life360, is looking to add to our group for the upcoming
ADC2.

If you are an Android fanatic and want a jumpstart on the next
competition shoot me an email.

We have a few pretty big legs up, such as:
-In House design, dev, and product teams
-Dataset of judge behavior from our winning ADC 1 entry
-A fully functional backend and codebase that will power our ADC 2
submission

Experienced Android developers are great, but we are also open to
rookies who are willing to work hard to learn the ropes.  In addition
to prize sharing, we can offer a stock options package that will give
a second chance for an upside whether or not we win the competition
again.

All specialties are needed, but we have our eye out for interface
wizards!

Chris
--~--~---------~--~----~------------~-------~--~----~

3. Change color of SeekBar

4. Add contact to G1

5. android security software/malware softwar

6. Did email send functionality work on emulator?

7. Home screen Widgets SDK