could u plz forward me complete code..........
On Oct 2, 12:32 pm, hackbod <[EMAIL PROTECTED]> wrote:
> This is really broken. Please read the documentation on broadcast
> receivers:
>
> http://code.google.com/android/reference/android/content/BroadcastRec...
>
> Also, please DO NOT then go and use a Service to leave your
> application running forever. Your application is simply not that
> important. We allow applications to run in the background, but
> applications that take advantage of this must be responsible and not
> sit there consuming resources for eternity.
>
> Generally if you want to do background things, you should use the
> alarm manager to schedule your application to be launched at some
> longish interval (hopefully 10 minutes or more) for it to do its work
> and then stop itself.
>
> On Sep 26, 6:01 pm, chouman82 <[EMAIL PROTECTED]> wrote:
>
> > I am trying to register the PhoneStateListener right when the phone
> > boots up so I have 2 classes. One is StartAtStartUp which extends
> >BroadcastReceiverthat listens for the COMPLETE_BOOT_UP and then this
> > will then register the CallStateListener which extends
> > PhoneStateListener. It doesn't seem to work out all that well.
>
> > I am not seeing any logging statements that I have put in
> > CallStateListener. Any help would be greatly appreciated!!!
>
> > Here is my code:
>
> > import android.content.BroadcastReceiver;
> > import android.content.Context;
> > import android.content.Intent;
> > import android.telephony.PhoneStateListener;
> > import android.telephony.TelephonyManager;
> > import android.util.Log;
>
> > import com.lumitrend.netlogger.Logger;
>
> > public class StartServicesAtStartUp extendsBroadcastReceiver
> > {
> > public void onReceive(Context context, Intent intent)
> > {
> > Log.d("DEBUG",
> > "########################################################################");
> > //Intent phoneStateListener = new Intent(context,
> > CallStateListener.class);
> >
> > //phoneStateListener.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
> > //context.startService(phoneStateListener);
> > Log.d("DEBUG", context.getPackageName());
> > Log.d("DEBUG", context.toString());
> > TelephonyManager tManager =
> > (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
> > CallStateListener callStateListener = new
> > CallStateListener();
> > tManager.listen(callStateListener,
> > PhoneStateListener.LISTEN_CALL_STATE);
> > }
>
> > }
>
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> > import android.telephony.PhoneStateListener;
> > import android.telephony.TelephonyManager;
> > import android.util.Log;
>
> > import com.lumitrend.netlogger.Logger;
>
> > public class CallStateListener extends PhoneStateListener
> > {
> > public void onCallStateChanged(int state, String incomingNumber)
> > {
> > Log.d("DEBUG", "addddddddddddddddddding this here");
> > super.onCallStateChanged(state, incomingNumber);
> > Log.d("DEBUG", TelephonyManager.CALL_STATE_OFFHOOK + "
> > weeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee are def in
> > here: " + state);
>
> > switch(state)
> > {
> > case TelephonyManager.CALL_STATE_IDLE:
> > Log.d("DEBUG",
> > "phhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhone is idle");
> > break;
> > case TelephonyManager.CALL_STATE_OFFHOOK:
> > Log.d("DEBUG",
> > "phoooooooooooooooooooooooooooooooooooooon is off
> > hook");
> > break;
> > case TelephonyManager.CALL_STATE_RINGING:
> > Log.d("DEBUG",
> > "phoooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnneeeeeeeeeeeeeeeeee
> > is ringing");
> > break;
> > default:
> > Log.d("DEBUG", "The
> > staaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaate is " +
> > state);
>
> > }
> > }
>
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---