about late resume, when PowerManagerService write on to /sys/power/state to call late resume

by Dianne Hackborn » Wed, 21 Apr 2010 06:47:43 GMT


Sponsored Links
 



Sorry, that isn't true.  If the process running the VM has permission to
access the file, then the Java code can access it.  Android doesn't use the
VM to enforce this (or most) kinds of security.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--



Other Threads

1. Save ListView items for next time

Hi,

My problem sounds pretty easy to solve... not getting any right
direction.

My app starts with a blank listview with a Menu option to Add contacts
to the ListView. Now, I want that my ListView gets saved every time I
quit my App so that the next time I start my App, I see all the
contacts from last time.

I understand that Android lets you store and retrieve data. Just don't
know how to move forward from here.

Any help in the right direction would be appreciated.

Thanks,

Abhishek

-- 

2. How can I call service methods from broadcastReceiver?

Hello

I made two applications. One for an activity receiving user input, the
other for a background service.
In the service package, I create two files
(startSensorBroadReceiver.java, remoteService.java).
StartSensorBroadReceiver will receiver an intent from activity
application and call method inside of the service.
There is no erron in the codes but I can not excute what is want.
I meet a message like this "The application ServiceExample has stopped
unexpectedly. Please try again."

could you let me know. what is wrong? and how I can call service
methods from broadcastReceiver?

/**
* startSensorBroadReceiver.java
*/
//broad cast receiver
public class StartSensorBroadReceiver extends BroadcastReceiver{

  @Override
  public void onReceive(Context context, Intent intent) {

    String whichTaskStartService = intent.getStringExtra
("whichTaskStartService");
    RemoteService s = new RemoteService();

    if(whichTaskStartService==null){
      Toast.makeText(context,R.string.error_unlocksensor_operation,
Toast.LENGTH_SHORT).show();
    }
    else if(whichTaskStartService.equals("StartSensor"))
    {
      //start service
      Toast.makeText(context,"start sensor function call",
Toast.LENGTH_SHORT).show();
      s.startSensor();
    }
    else if(whichTaskStartService.equals
("StopMotionDetectUnlockSensor"))
    {
      //stop service
      Toast.makeText(context,"stop sensor function call",
Toast.LENGTH_SHORT).show();
      RemoteService s = new RemoteService();
      s.stopSensor();
    }
  }
}

/**
* remoteService.java
*/
public class RemoteService extends Service {

  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    Toast.makeText(this,R.string.service_start,
Toast.LENGTH_SHORT).show();
  }

  @Override
  public void onDestroy() {
    super.onDestroy();
    Toast.makeText(this,R.string.service_destory,
Toast.LENGTH_SHORT).show();
  }

  SensorManager sensorManager;

  public void startSensor(){
    String service_name = Context.SENSOR_SERVICE;
    sensorManager = (SensorManager)getSystemService(service_name);
    sensorManager.registerListener(accelSensorListener,
    SensorManager.SENSOR_ACCELEROMETER,SensorManager.SENSOR_DELAY_UI);
  }

  public void stopSensor(){
    sensorManager.unregisterListener(accelSensorListener);
  }

  @SuppressWarnings("deprecation")
  SensorListener accelSensorListener = new SensorListener() {

    @Override
    public void onAccuracyChanged(int arg0, int arg1) {
      // TODO Auto-generated method stub
    }

    SensorDetectClass motion;

    @Override
    public void onSensorChanged(int sensor, float[] values) {
      // TODO Auto-generated method stub
      if(sensor == SensorManager.SENSOR_ACCELEROMETER)
      {

      };
    }
  }
}

-- 

3. Application developed in 1.5 r 3 not working in Motorola Droid

4. Bitmap questions

5. Dual Camera Support for Video Telephone

6. Please Help me find why htt pclient.execute(httppost)锛沘lways throws IOException

7. Please Help me find why httpclient.execute(httppost)锛沘lways throws IOException