简体   繁体   中英

TimerTask and Broadcast Receiver onReceive

I have multiple times onReceive triggered with different data for intent during each occurence. I need to combine all the intent data into a list of intents inside a background thread. How can I achieve this? I tried using timer task, but couldn't achieve the same. Is there any other way? Kindly explain with examples as I don't have much knowledge on background thread BlockingQueue cannot be used as It will block UI thread for a long time is what I saw in stackoverflow.

You could use AsyncTask and do you operations in the doInBackground()-method. Check out Android's AsyncTask documentation . (Was deprecated in Android R, however)

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