How can i access FlashLight using Services in android?????

  • Thread starter Thread starter Android Central Question
  • Start date Start date
A

Android Central Question

Used this Service in my source code:

//Registered inn Manifest File:

<service android:name=".FlashLightService"
android:enabled="true"/>

What code should i write to turnOn n turnOff flashlight using one toggle button?

//.FlashLightService file has this:

@override
public int onStartCommand(Intent intent, int flags, int startId) {

Toast.makeText(getApplicationContext(),"FlashLight is : ON", Toast.LENGTH_SHORT).show();

return super.onStartCommand(intent, flags, startId);
}

@override
public void onDestroy() {
super.onDestroy();

Toast.makeText(getApplicationContext(),"FlashLight is: OFF",Toast.LENGTH_SHORT).show();

}
 
I moved this to the Software Development forum for more specific traffic.
 

Forum statistics

Threads
953,957
Messages
6,960,056
Members
3,162,894
Latest member
OBA90