hi guys,

I'm trying to log the phone's cell movement. So I created a
PhoneStateListener that is being called when the CellLocation has been
changed. Then it informs a logging service to write that new cell
information to a log file.

This works as long as the screen is on. But when the screen goes off,
the logging stops.

I have two classes:

The PhoneStateListener gets loaded on boot time
public class CellStateListener extends PhoneStateListener {
  public void onCellLocationChanged(CellLocation location) {
    ...
    //this is the logging service which is informed when the cell
location changes
    listener.onCellChanged(mcc, mnc, lac, cid);
    ...
  }
}

The logging service is being loaded on boot time too
public class CellLoggingService extends Service implements
ICellListeners {
  public void onStart(Intent intent, int startId) {
    phoneStateListener.listen(this);
  }

  public void onCellChanged(int mcc, int mnc, int lac, int cid) {
        //write to log file
  }
}

I tried to use the PowerManager to set a PARTIAL_WAKE_LOCK in my
logging service. But this doesn't work. I also use this.setForeground
(true) in my logging service.
Asap the screen goes on, cell changed are logged again. So the service
keeps running, but is not active in standby.

Could I use AlarmManager to solve this problem?

Thanks for your help.

--~--~---------~--~----~------------~-------~--~----~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to