-
-
Save anonymous/a27dd9d91c59a731c14a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public int onStartCommand(Intent intent, int flags, int startId) { | |
if(intent.getAction().equals("start")) | |
{ | |
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); | |
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); | |
sensorManager.registerListener(this, sensor, | |
SensorManager.SENSOR_DELAY_FASTEST); | |
} | |
else if(intent.getAction().equals("stop")) | |
{ | |
stopSelf(); | |
} | |
return START_STICKY; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment