0

I am trying to start service from AsyncTask but cant see that its starts. I also added Service on manefast file.

here the code:

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

and the manifest file:

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

  </application>

thanks for help.

Vitaly Menchikovsky
  • 6,164
  • 16
  • 53
  • 88

2 Answers2

1

services.conServise should be in a <action> tag within the <intent-filter> tag for that declaration of service, please replace servicesclassname with the appropriate package name for example, org.mypkg.foo.bar.

<service android:name="<servicesclassname>">
    <intent-filter>
        <action android:name="services.conServise"/>
    </intent-filter>
</service>
t0mm13b
  • 33,483
  • 8
  • 75
  • 107
Dheeresh Singh
  • 15,570
  • 3
  • 36
  • 36
0

Try it via onPostExecute() method in AsyncTask class. Thanks

Md Abdul Gafur
  • 6,169
  • 2
  • 26
  • 37