小编Bal*_*san的帖子

在android中一次运行多个服务

我正在开发一个带有多个标签的android应用程序.我的标签有以下内容.

第一个选项卡 - 它在网格视图中显示杂志的存档.目的是当我点击网格视图项时,我需要从网站下载一个大文件.为此,我创建了一个具有ASYNC任务的服务,该任务将下载该文件.我已经展示了代码.

 public class DownloadArchivesService extends BaseService {
private static final String TAG = "DownloadArchivesServices";
private static final String STOP = "stop_modificator";
public static final String ALREADY_RUNNING= "DownloadArchivesService_Already_Running";
public  static final String ARCHIVES_PERCENTAGE_PROGRESS ="Archives_Percentage_Progress";
public  static final String UPDATE_ARCHIVES_PROGRESS = "Update_Archives_Progress";

 @Override
public void onCreate() {
            getPreferences().edit().putBoolean(ALREADY_RUNNING,   true).commit();
    application = (JfwApplication)this.getApplicationContext();
    context = this;
    session = application.getSession();
    calendar = Calendar.getInstance();
    dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
    magazineManager = new MagazineManager(this);

    //magazine = new Magazine(fileName, fileName, "", "", this);


    new AsyncTask<String, …
Run Code Online (Sandbox Code Playgroud)

service android

2
推荐指数
1
解决办法
7870
查看次数

标签 统计

android ×1

service ×1