Now, my program have an activity and a service. The serv开发者_运维知识库ice runs in the background and sometimes vibrates to ask users give some selection. I meet a problem here. I know broadcast could pass data from service to activity. But if the activity is not working, then it cannot receive the broadcast information, so if user feels vibration but after a period of time start the activity then the activity will miss the broadcast information and cannot ask user to choose a selection. So does anybody know how to actively request the data from the service by activity? I just want when I onCreate() or onResume() the activity, my app could update UI in time?
Thanks
You can use Shared Preference for storing data... By using this you can access data throughout your application life cycle.
精彩评论