Hi i created a service successfully
public class Securityservice extends Service {
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
super.onCreate();
Log.d("Service","I Am Security Service Created");
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
}
I got that Log message in onCreate() ..
but the problem is i got that message only once at the time of service created
i need to keep print the log Untill i destroyed the service
Service is an BackGround task which runs until you stop which contains its own life cycle.
Where as Thread is also a new task which runs until you stop or end of the code, which contains its own life cycle.
While creating the Service onCreate method will call only one time..
I think you have some confusion between Loop and Thread..
it is must to start a loop (for or while) to print that log continuously ..
or you can use this type of recursive method