jeudi 14 juillet 2016

stopself() service not working

hi evryone i need to stop the service from them self and i use the stopSelf method but the service is not stoped... can you help me please

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    int hour = MainActivity.sa3a;
    int minute = MainActivity.dakika;
    java.text.DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Date date = new Date();
    System.out.println(dateFormat.format(date));
    int x = date.getHours();
    int y = date.getMinutes();
    String n = String.valueOf(x);
    Toast.makeText(send.this,n, Toast.LENGTH_SHORT).show();
    if (hour == x && minute == y) {
        Toast.makeText(send.this, "start", Toast.LENGTH_SHORT).show();
        send.this.stopSelf();
        Toast.makeText(send.this, "stop_Self_is_Not_work", Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(send.this, "yOKKKKKK", Toast.LENGTH_LONG).show();
    }

    return START_STICKY;
}

Aucun commentaire:

Enregistrer un commentaire