Pessoal...
Estou com problema para parar um Serviço no Android...
<service android:name=".model.ServiceTimer">
<intent-filter>
<action android:name="INICIAR_SERVICO_NOWWW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
startService(StaticIntent.getInstance());
startActivity(new Intent(Login.this, RecordAndSend.class).putExtra("nomeusuario", _nomeus));
stopService(StaticIntent.getInstance());
import android.content.Intent;
public class StaticIntent {
public static Intent inten = new Intent("INICIAR_SERVICO_NOWWW");
public static Intent getInstance() {
return inten;
}
}
@Override
public void onDestroy() {
super.onDestroy();
stopSelf();
Log.i(CATEGORIA, "PAROU!!");
}
Quando eu mando parar, ele exibe essa mensagem ("PAROU!!")... Mas continua realizando as funções (exibindo mensagens)...
Ele está assim:@Override
public void onStart(Intent intent, final int startId){
super.onStart(intent, startId);
Log.i(CATEGORIA, "Comecando");
_timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Log.i(CATEGORIA, "Executando Tarefa");
}
}, 0, 20000);
}