0

AsyncTaskからサービスを開始しようとしていますが、サービスが開始されていることがわかりません。manefastファイルにもサービスを追加しました。

ここにコード:

protected Integer  doInBackground(Void... values) throws InterruptedException {
    //starts service number activite
    Intent serviceIntent = new Intent();
    serviceIntent.setAction("services.conServise");
    context.startService(serviceIntent);

およびマニフェストファイル:

   <service android:name="services.conServise"></service>

  </application>

手伝ってくれてありがとう。

4

2 に答える 2

1

services.conServiseそのサービス宣言の<action>タグ内のタグに ある必要があります。servicesclassnameを適切なパッケージ名 ( org.mypkg.foo.barなど) に置き換えてください。<intent-filter>

<service android:name="<servicesclassname>">
    <intent-filter>
        <action android:name="services.conServise"/>
    </intent-filter>
</service>
于 2012-06-23T08:58:35.777 に答える
0

AsyncTask クラスの onPostExecute() メソッドで試してみてください。ありがとう

于 2012-06-23T09:00:26.120 に答える