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
955,995
Messages
6,966,354
Members
3,163,457
Latest member
dongapko1