简体   繁体   中英

sending data from activity to Intentservice

my needs is to send data from activity to IntentService

(from class that extends activity, to class that extends IntentService)

i successed to send to sample service, by using BroadcastReciver, but i want to extend IntentService class and not service

someone know how can i do that?

from

public class MainActivity extends Activity { ... }

to

public class MyIntentService extends IntentService { ... }

Put the data in an Intent extra that you use with the startService() call to start your IntentService . Then, the IntentService can read that extra in onHandleIntent() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM