使用参数启动Android服务

时间:2010-07-01 07:46:31

标签: android

我想启动一个包含参数的服务

public BackgroundHelperService(String name)

如何使用

执行此操作
Intent service = new Intent(cnx, BackgroundHelperService.class);

我无法传递名称参数。

1 个答案:

答案 0 :(得分:1)

  

我无法传递名称参数。

正确。您无法传递构造函数参数。如果BackgroundHelperService正在延长IntentService,请自行提供名称:

public BackgroundHelperService() {
  super("BackgroundHelperService");
}