Reputation: 175
My service is working the problem is while is running it's showing a black screen until the service finish.
Intent Service = new Intent();
Service.setClass(Activity.this,sendInformation.class);
Service.putExtra("IP",IP1);
Service.putExtra("Port",Port1);
Activity.this.startService(Service);
how i can say "while service is running" back to home?
Upvotes: 0
Views: 185
Reputation: 31856
From the Service
documentation:
Note that services, like other application objects, run in the main thread of their hosting process. This means that, if your service is going to do any CPU intensive (such as MP3 playback) or blocking (such as networking) operations, it should spawn its own thread in which to do that work.
Just create an AsyncTask
if you want multithreading.
Upvotes: 1
Reputation: 48272
What you are doing in your server happens on the main thread. Try using IntentService instead or try spanning your own thread from your server's onStartCommand. Usually IntentService is fine.
Upvotes: 1