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();
}
//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();
}