我想以靜態方式啓動服務。所以從我的活動我打電話onCreate android服務不叫
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"/>
爲什麼服務沒有啓動任何想法?
是的,我要問他是否真的用Intent做了什麼...... – dmon 2013-02-14 14:55:45