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
  • 7,684
  • 17
  • 57
  • 89

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
  • 34,087
  • 8
  • 78
  • 110
Dheeresh Singh
  • 15,643
  • 3
  • 38
  • 36
0

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

Md Abdul Gafur
  • 6,213
  • 2
  • 27
  • 37