Skip to main content

Posts

Showing posts from 2019

Service in Android

Service in Android A Service is an application component that can perform long-running operations in the background, and it doesn't provide a user interface. Another application component can start a service, and it continues to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform inter process communication (IPC). For example, a service can handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background. These are the three different types of services: Foreground   A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to play an audio track. Foreground services must display a Notification . Foreground services continue running even when the user isn't interacting with the app.   Background   A background service performs a

Activity Life Cycle States

      Activity Life Cycle Example  https://drive.google.com/file/d/1ald91YAfWEit05irie7NolPm4h1OFpIy/view?usp=sharing Activity Life Cycle         As a user navigates through, out of, and back to your app, the Activity instances in your app transition through different states in their lifecycle. The Activity class provides a number of callbacks that allow the activity to know that a state has changed: that the system is creating, stopping, or resuming an activity, or destroying the process in which the activity resides.       Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity. For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app. When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot. In other words, each callback allows you