How to keep a service running to listen for incoming and outgoing calls

by David_Fisher » Thu, 07 Oct 2010 06:40:34 GMT


Sponsored Links
 Hi, how should I create a service that would keep on running in the
Background and listen for incoming and outgoing calls? I don't want
the service to die at any point in time. I have created a Broadcast
Receiver in my service class that is set for
ACTION_PHONE_STATE_CHANGED action. In my BroadcastReceiver, I have set
up a PhoneStateListener that would listen for changes in phone states.
Is this the right approach? Thanks.
David

--



How to keep a service running to listen for incoming and outgoing calls

by Mark Murphy » Thu, 07 Oct 2010 06:56:11 GMT


 


That is redundant. ACTION_PHONE_STATE_CHANGED reports the same events
as the PhoneStateListener. Just use the ACTION_PHONE_STATE_CHANGED
BroadcastReceiver. You should not need a Service.

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

_Android Programming Tutorials_ Version 3.0.1 Available!

--


Sponsored Links


How to keep a service running to listen for incoming and outgoing calls

by Kumar Bibek » Thu, 07 Oct 2010 13:52:02 GMT


 Yeah. This is fine I guess. Are you stuck somewhere?




>



Other Threads

1. problem in overriding onkeydown method of gallery

Hi

 

I am trying to create an application in which I am implementing gallery
and checkbox.

Now my need is that whenever I click on either right or left arrow key,
image should be changed and simultaneously I want to change the state of
checkbox.

I tried to override onkeydown method but on right and left click images
are changing but state of checkbox is not changing.

Please help me.

 

Snippet of code is as follows-

 

@Override

      public boolean onKeyDown(int keyCode, KeyEvent event) {

          switch (keyCode) {

          case KeyEvent.KEYCODE_DPAD_LEFT:

            if(check.isChecked())

            {

              check.setChecked(false);

              check.invalidate();

            }

           

              break;

          case KeyEvent.KEYCODE_DPAD_RIGHT:

            if(check.isChecked())

            {

              check.setChecked(false);

              check.invalidate();

            }

              break;

          }

          return super.onKeyDown(keyCode, event);

      }

 

 



============================================================================================================================

Disclaimer:

This message and the information contained herein is proprietary and 
confidential and subject to the Tech Mahindra policy statement, you may review 
the policy at http://www.techmahindra.com/Disclaimer.html externally and 
http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================
--~--~---------~--~----~------------~-------~--~----~

2. What kind of text file can android read?

Is there any basic reader software in android?
If 'yes', what kind of text file is accepted?
For example, '.doc', '.txt'.

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

3. about package.org.apache

4. Amount of Zoom from Distance in Maps (Very Easy)

5. openFileOutput questions / clarifications

6. FPS troubles and texture problems

7. DatabaseContentProvider got RuntimeException while getContentResolver() try to insert Email to contacts in SDK M5