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.
 

Trending Posts

Members online

Forum statistics

Threads
956,757
Messages
6,969,809
Members
3,163,608
Latest member
cambium