Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - anyone else faces problem with phoneStateListener???

anyone else faces problem with phoneStateListener???

Put your problem here if it does not fit any of the other categories.

anyone else faces problem with phoneStateListener???

Postby chouman » Thu Oct 09, 2008 7:24 pm

Can anyone give a simple example of the usage of PhoneStateListener?

I have tried to overwrite the listener and register it with the TelephonyManager with the Context.TELEPHONY_SERVICE.

But i only saw my logging statement printed out right when I started to run the application. The logging showed the PhoneState as IDLE. But then after that when I use telnet to emulate an incoming call, I don't see the logging statement been printed for PhoneState - RINGING or PhoneState - OFFHOOK.

here is my code snippet:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. TelephonyManager tm = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
  3.  
  4. tm.listen(this, CallStateListener.LISTEN_CALL_STATE);
  5.  
  6.  
  7.  
  8. public void onCallStateChanged(int state, String incomingNumber)
  9.  
  10. {
  11.  
  12.     switch(state)
  13.  
  14.     {
  15.  
  16.           case TelephonyManager.CALL_STATE_DLE:
  17.  
  18.                Log.d(DEBUG, "PHONE STATE - IDLE");
  19.  
  20.                break;
  21.  
  22.           case TelephonyManager.CALL_STATE_OFFHOOK:
  23.  
  24.                Log.d(DEBUG, "PHONE STATE - OFFHOOK");
  25.  
  26.                break;
  27.  
  28.           case TelephonyManager.CALL_STATE_RINGING:
  29.  
  30.                Log.d(DEBUG, "PHONE STATE - RINGING");
  31.  
  32.                break;
  33.  
  34.      }
  35.  
  36. }
  37.  
  38.  
Parsed in 0.014 seconds, using GeSHi 1.0.8.4
chouman
Developer
Developer
 
Posts: 27
Joined: Thu Jan 03, 2008 2:59 pm

Top

Postby soniya » Fri Oct 10, 2008 8:00 am

no....
it's working
Use 2 classes
1. In Activity u use

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  MyPhoneStateListener phoneListener=new MyPhoneStateListener();
  2.  
  3.         TelephonyManager telephony = (TelephonyManager)this.getSystemService(this.TELEPHONY_SERVICE);
  4.  
  5.            telephony.listen(phoneListener,PhoneStateListener.LISTEN_CALL_STATE);
  6.  
  7.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


2.MyPhoneStateListener extends PhoneStateListener
use
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  public void onCallStateChanged(int state,String incomingNumber){
  2.  
  3.              switch(state)
  4.  
  5.              {
  6.  
  7.                    case TelephonyManager.CALL_STATE_IDLE:
  8.  
  9.                         Log.d("DEBUG", "PHONE STATE - IDLE");
  10.  
  11.                         break;
  12.  
  13.                    case TelephonyManager.CALL_STATE_OFFHOOK:
  14.  
  15.                         Log.d("DEBUG", "PHONE STATE - OFFHOOK");
  16.  
  17.                         break;
  18.  
  19.                    case TelephonyManager.CALL_STATE_RINGING:
  20.  
  21.                         Log.d("DEBUG", "PHONE STATE - RINGING");
  22.  
  23.                         break;
  24.  
  25.               }
  26.  
  27. }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


try it.....
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby MrSnowflake » Fri Oct 10, 2008 11:44 am

Yet your code is the same... :s
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby chouman » Fri Oct 10, 2008 6:02 pm

I did tried with 2 classes as well, but it's not working for me.

This is the only logging that I see:

Code: Select all
D/PhoneApp(   88): [CallNotifier] RINGING... (new)
D/PhoneApp(   88): [CallNotifier] onNewRingingConnection()... connection: incoming
D/PhoneApp(   88): [CallNotifier] - connection is ringing!  state = INCOMING
D/PhoneApp(   88): [CallNotifier] starting query and setting timeout message.
D/PhoneApp(   88): [CallNotifier] Holding wake lock on new incoming connection.
D/PhoneApp(   88): acquire screen lock
D/PhoneApp(   88): [CallNotifier] - onNewRingingConnection() done.
D/PhoneApp(   88): [CallNotifier] callerinfo query complete, updating data
I/ActivityManager(   53): Starting activity: Intent { action=android.intent.action.MAIN flags=0x10800000 comp={com.andro
id.phone/com.android.phone.InCallScreen} }
I/System.out( 2549): [DEBUG] {main,5,main]} paused.
D/PHONE/InCallScreen(   88): onCreate()...  this = com.android.phone.InCallScreen@433adc10
D/PhoneApp(   88): [CallNotifier] setCallScreen: com.android.phone.InCallScreen@433adc10
D/PHONE/InCallScreen(   88): - mBluetoothHandsfree: null
I/System.out( 2549): [DEBUG] {main,5,main]} stopped.
D/PHONE/InCallScreen(   88): initInCallScreen()...
D/PHONE/InCallScreen(   88): [InCallScreen.ConfigurationHelper] initConfiguration({ scale=1.0 imsi=310/260 locale=en_US
touch=3 key=2/2 nav=3 orien=1 })...
D/PHONE/InCallScreen(   88):   - mCallCard = com.android.phone.CallCard@43449b08
D/PHONE/InCallScreen(   88): onCreate(): this is our very first launch, checking intent...
D/PHONE/InCallScreen(   88): internalResolveIntent: action=android.intent.action.MAIN
D/PHONE/InCallScreen(   88): onResume()...
D/PhoneApp(   88): disable keyguard
D/PHONE/InCallScreen(   88): - onResume: mInCallInitialStatus = SUCCESS
D/PHONE/InCallScreen(   88): setInCallScreenMode: NORMAL
D/PHONE/InCallScreen(   88): [okToDialDTMFTones] foreground state: IDLE, ringing state: true, call screen mode: NORMAL,
result: false
D/PHONE/InCallScreen(   88): syncWithPhoneState()...
D/PhoneUtils(   88): ############## dumpCallState() #############
D/PhoneUtils(   88): ---
D/PhoneUtils(   88): --- Phone: com.android.internal.telephony.gsm.GSMPhone@43394eb0
D/PhoneUtils(   88): --- Overall Phone state: RINGING
D/PhoneUtils(   88): ---
D/PhoneUtils(   88): --- FG call: IDLE
D/PhoneUtils(   88): --- FG call state: IDLE
D/PhoneUtils(   88): --- FG call isAlive(): false
D/PhoneUtils(   88): --- FG call isRinging(): false
D/PhoneUtils(   88): --- FG call isDialing(): false
D/PhoneUtils(   88): --- FG call isIdle(): true
D/PhoneUtils(   88): --- FG call hasConnections: false
D/PhoneUtils(   88): ---
D/PhoneUtils(   88): --- BG call: IDLE
D/PhoneUtils(   88): --- BG call state: IDLE
D/PhoneUtils(   88): --- BG call isAlive(): false
D/PhoneUtils(   88): --- BG call isRinging(): false
D/PhoneUtils(   88): --- BG call isDialing(): false
D/PhoneUtils(   88): --- BG call isIdle(): true
D/PhoneUtils(   88): --- BG call hasConnections: false
D/PhoneUtils(   88): ---
D/PhoneUtils(   88): --- RINGING call: INCOMING
D/PhoneUtils(   88): --- RINGING call state: INCOMING
D/PhoneUtils(   88): --- RINGING call isAlive(): true
D/PhoneUtils(   88): --- RINGING call isRinging(): true
D/PhoneUtils(   88): --- RINGING call isDialing(): false
D/PhoneUtils(   88): --- RINGING call isIdle(): false
D/PhoneUtils(   88): --- RINGING call hasConnections: true
D/PhoneUtils(   88): ---
D/PhoneUtils(   88): --- hasRingingCall: true
D/PhoneUtils(   88): --- hasActiveCall: false
D/PhoneUtils(   88): --- hasHoldingCall: false
D/PhoneUtils(   88): --- allLinesTaken: false
D/PhoneUtils(   88): --- ringing (Ringer manager state): true
D/PhoneUtils(   88): ---
D/PhoneUtils(   88): ---------------------
D/PHONE/InCallScreen(   88): syncWithPhoneState: update screen
D/PHONE/InCallScreen(   88): updateScreen()...
D/PHONE/InCallScreen(   88): - updateScreen: updating the in-call UI...
D/dalvikvm(   88): GC freed 4204 objects / 254064 bytes in 150ms
D/PHONE/InCallScreen(   88): [okToDialDTMFTones] foreground state: IDLE, ringing state: true, call screen mode: NORMAL,
result: false
D/PHONE/InCallScreen(   88): updateMenuButtonHint()...
D/PhoneApp(   88): [CallNotifier] setCallScreen: null
D/PhoneApp(   88): setting medium poke lock
D/PHONE/InCallScreen(   88): onPhoneStateChanged()...
D/PHONE/InCallScreen(   88): updateScreen()...
D/PHONE/InCallScreen(   88): - updateScreen: updating the in-call UI...
D/PHONE/InCallScreen(   88): [okToDialDTMFTones] foreground state: IDLE, ringing state: true, call screen mode: NORMAL,
result: false
D/PHONE/InCallScreen(   88): updateMenuButtonHint()...
D/PHONE/InCallScreen(   88): handling key up event...
I/ActivityManager(   53): Displayed activity com.android.phone/.InCallScreen: 1731 ms
W/AudioFlinger(   24): write blocked for 52 msecs
D/dalvikvm(   92): GC freed 226 objects / 11720 bytes in 125ms
D/PHONE/InCallScreen(   88): handling key up event...
W/KeyCharacterMap(   88): No keyboard for id 0
W/KeyCharacterMap(   88): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
D/PHONE/InCallScreen(   88): handleCallKey: ringing ==> answer!
D/PHONE/InCallScreen(   88): internalAnswerCall()...
I/phone   (   88): acceptCall: incoming...
D/PhoneApp(   88): [CallNotifier] onPhoneStateChanged: OFF HOOK
D/PHONE/InCallScreen(   88): onPhoneStateChanged()...
D/PHONE/InCallScreen(   88): updateScreen()...
D/PHONE/InCallScreen(   88): - updateScreen: updating the in-call UI...
D/PHONE/InCallScreen(   88): [okToDialDTMFTones] foreground state: ACTIVE, ringing state: false, call screen mode: NORMA
L, result: true
D/PHONE/InCallScreen(   88): updateMenuButtonHint()...
D/PhoneApp(   88): release screen lock
D/dalvikvm( 2549): GC freed 7108 objects / 489464 bytes in 163ms
chouman
Developer
Developer
 
Posts: 27
Joined: Thu Jan 03, 2008 2:59 pm

BroadcastReceiver Lifecycle

Postby leoromanovsky » Thu Jun 11, 2009 5:19 am

I ran into a similiar problem.

Please take a look at the section regarding the BroadcastReceiver lifecycle and the work arounds that Google proposes.

http://developer.android.com/reference/ ... eiver.html
leoromanovsky
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 01, 2009 4:08 am
Location: Chicago, IL

Re: anyone else faces problem with phoneStateListener???

Postby Draffodx » Thu Jul 01, 2010 11:23 am

You need to add a permission
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media, Yahoo [Bot] and 18 guests