@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG,"onStartCommand() 호출됨");
if(intent != null)
{
String command = intent.getStringExtra("command");
if(command != null)
{
if(command.equals("start")) {
PrintThread thread= new PrintThread();
thread.start();
}
}
}
return super.onStartCommand(intent, flags, startId);
}
class PrintThread extends Thread{
public void run(){
for(int i=0;i<100;i++){
Log.d(TAG, i + " 서비스 반복됨");
try{
Thread.sleep(100);
}
catch (Exception e){
e.printStackTrace();
}
}
}
}