启动服务非常容易,只需startService在Activity中有意图地调用即可:
Intent intent = new Intent(this, MyService.class); //用您的服务名称替换MyService intent.putExtra(Intent.EXTRA_TEXT, "Some text"); //添加任何额外的数据以传递给服务 startService(intent); //调用startService启动服务。