我希望以静态方式启动一个服务。因此,从我的活动中调用以下代码:
SpeechActivationService.makeStartServiceIntent(
this.getApplicationContext(),
"WordActivator");
这是一个从服务类继承的实际类http://dpaste.com/hold/928115/。您可以看到有几个日志点,例如在onCreate方法中。
这不会被记录。只有当我在makeStartServiceIntent方法中放置日志文本时,它才出现,但不在onCreate方法中。
这是makeStartServiceIntent方法:
public static Intent makeStartServiceIntent(Context context,
String activationType) {
Intent i = new Intent(context, SpeechActivationService.class);
i.putExtra(ACTIVATION_TYPE_INTENT_KEY, activationType);
return i;
}
在清单文件中,我有以下内容:
<service android:name="root.gast.speech.activation.SpeechActivationService"/>
有什么想法,为什么服务没有启动?