I am trying to develop a application in android that consists a service to read the sensor value for multiple hours. When i start the service my device get hang and all the other process is got slow. To solve this problem i have try to startservice in separate thread as given below but problem is still there.
new Thread(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(getApplicationContext(), SensorService.class);
startService(intent);
}
}).start();
this thread only start the service in different thread but service run in main thread. Plz someone help me how to run service in separate thread ?