BroadcastReceiver to log PhoneState during of my activity

by Mak » Sun, 15 Mar 2009 11:07:59 GMT


Sponsored Links
 Hi.
I'd like to log some telephonyManager and phoneState events as
onCellLocationChanged and onCallStateChanged.. during my activity.
Cause i need this for more than one activity,  i created an
broadcastReceiver that receives broadcasts, when something special in
my activities happen.

But my problem is that i can't define a telephonyManager in the
broadcastReceiver
like in an activity.
Why wont the following work in?

.............
TelephonyManager tmanager = (TelephonyManager)
                                      getSystemService
(Context.TELEPHONY_SERVICE);
tmanager.listen( new PhoneStateListener(){

        public void onCallStateChanged(int state, String incomingNumber) {
                super.onCallStateChanged(state, incomingNumber);
                callstate =  state;
       }

}, PhoneStateListener.LISTEN_CALL_STATE);
...........

Why is getSystemService(String) undefined for a broadcastReceiver?
Where is my fault?
Thanks for an answer.
Mak
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. download dari rapid, dll yang ane

Masalah di username kali...

Sol
--

***************************************
  www.MiniDarkStore.com 
    -- For your fashion life style
***************************************
ym: minidarkstore


-----Original Message-----
From: Ade Candra <ade.candra....@gmail.com>
Sender: id-android@googlegroups.com
Date: Sun, 23 May 2010 23:24:10 
To: Indonesian Android Community [id-android]<id-android@googlegroups.com>
Reply-To: id-android@googlegroups.com
Subject: [id-android] [Ask] download dari rapid, dll yang aneh

Untuk bro semua yang pernah download dari rapid, mediafire, dll, kenapa
kalau kita download kadang gak bisa karena size undefined?? Atau cuma
download 7,3kb padahal filenya ratusan kb? Dan itu terjadi berulang kali..
ada yang bisa jelasin? Bukan cuma browser bawaan cupcake tapi juga dolphin
browser saya.

Huawei eclair - cupcake

-- 
"Indonesian Android Community [id-android]" 

2. GPS application not installing in Sony Xperia

Any idea why this error occurs..

Nithin




-- 

3. how to DEBUG build an APK?

4. Where can I get an installable Froyo image for my Android Market Device Seeding Program Nexus One?

5. Default number sms

6. Playing Audio During call so that other person on call can hear it

7. A Flash Games Site Just For Froyo