package com.example.svc.services;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import com.example.svc.utilities.Downloader;

public class DownloadService2 extends Service {
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public int onStartCommand(final Intent intent, int flags,
            final int startId) {
        new Thread(new Runnable() {
            public void run() {
                String url = intent.getStringExtra("Url");
                Downloader d =
                        new Downloader(getApplicationContext(), url);
                d.downloadFile();
                stopSelf(startId);
            }
        }).start();

        return START_NOT_STICKY;
    }
}