Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the flow of Serviced, the core component of Android

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the Android core component Serviced process is how the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this Android core component Serviced process article will have a harvest, let's take a look at it.

Activity and Service,context.startService correspond to the onStart () method in Service, and context.onBindService corresponds to onBind () method in Service. When we continue to bind a Service and want to stop the Activity, the Service will not stop, we can first StartService, and then BindService (). The flow chart at this time is as follows:

At this time, we need to pay attention to a problem. When Activity exits, Sercvice will not stop. At this time, we can re-bind Activity. At this time, Service will call the onRebind () method, but the onRebind () method is called only if the previous onUnbind () method is executed successfully, but using super.onUnbind (intent) is not successful. In this case, we need to manually return it to true, and bind it again and Rebind () will be executed. Otherwise, if the specified onUnbind () that is not displayed on exit is successful (false), then when the Activity is restarted to bind the service, neither the onBind () method of Service nor the onReBind will be executed, but the ServiceConnection method will definitely be called back. This means that the onBind () method in Service, unlike the onStart () method, cannot be called repeatedly.

This is the end of the article on "what is the process of Serviced, the core component of Android?". Thank you for reading! I believe you all have a certain understanding of "what is the process of Serviced, the core component of Android". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report