This document discusses various background processing techniques in Android including services, threads, AsyncTask, IntentService, JobScheduler, AlarmManager, ContentProvider, and DownloadManager. It provides examples of when to use each technique and considerations around restarting services, binding, and syncing.
Introduction to concurrency in Android application development.
Describes about using AsyncTask and Handler. Contains information on AsyncTask's screen rotation issue
Introduction to concurrency in Android application development.
Describes about using AsyncTask and Handler. Contains information on AsyncTask's screen rotation issue
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...Fwdays
Micro-frontends has been a hyped topic for the last several years but unfortunately, it is hard to find ready to production solution. We built in-house open-source solution that allows us to deliver more than 100 apps continuously. Micro-frontends is not only about code splitting it is about the full development cycle and I will try to explain to you how we use it in production.
Browser. FrontEnd Frameworks. Gateway. Server. Scaling. Delivery.
Data Transfer between Activities & DatabasesMuhammad Sajid
Data Transfer between Activities & Databases, Android services components that are issued to perform operations in the background such as playing music, handling network transactions, interacting with content providers, etc. It doesn't have any UI (user interface).
The service runs in the background indefinitely even if the application is destroyed. 1. Foreground-A foreground service performs some operation that is noticeable to the user. Start Service()
2. Background-A background service performs an operation that isn't directly noticed by the user. Start Service()
3. Bound-A service is bound when an application component binds to it by calling bindService(). Abound service offers a client-server interface that allows components to interact with the service, send requests, receive results, and even do so across processes with inter-process communication (IPC). Abound
service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed.
Linux kernel
At the bottom of the layers is Linux -Linux 3.6 with approximately 115 patches. This provides a level of abstraction between the device hardware and it contains all the essential hardware drivers like camera, keypad, display etc. Also, the kernel handles all the things that Linux is really good at such as networking and a vast array of device drivers, which take the pain out of interfacing to peripheral hardware.
Browser
Bluetooth
Animation
A presentation given at GDG Cape Town about how to build a chat app in a very secure and stable way using Firebase.
We used Kotlin and Node.js. From Firebase we used: Realtime Database, Cloud Functions, Notifications, Auth & Storage.
I would like to share an experience of using the recommended Android way to synchronize your application cache. SyncAdapter is very powerful and at the same time seems to be complex.
Along with features & functionality overview I've provided some leads to start using it right away with sample code.
Serverless Design Patterns (London Dev Community)Yan Cui
Serverless technologies like AWS Lambda has drastically simplified the task of building reactive systems - drop a file into S3 and a Lambda function would be triggered to process it, push an event into a Kinesis stream and magically it'll be processed by a Lambda function in real-time, you can even use Lambda to automate the process of auditing and securing your AWS account by automatically reacting to rule violations to your security policy.
Join us in this talk to see some architectural design patterns that have emerged with AWS Lambda, and learn how to pick the right event source based on the tradeoffs you want. Amongst the many patterns we'll explore, here are a few to whet your appetite : pub-sub, cron, push-pull, saga and decoupled invocation.
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...Fwdays
Micro-frontends has been a hyped topic for the last several years but unfortunately, it is hard to find ready to production solution. We built in-house open-source solution that allows us to deliver more than 100 apps continuously. Micro-frontends is not only about code splitting it is about the full development cycle and I will try to explain to you how we use it in production.
Browser. FrontEnd Frameworks. Gateway. Server. Scaling. Delivery.
Data Transfer between Activities & DatabasesMuhammad Sajid
Data Transfer between Activities & Databases, Android services components that are issued to perform operations in the background such as playing music, handling network transactions, interacting with content providers, etc. It doesn't have any UI (user interface).
The service runs in the background indefinitely even if the application is destroyed. 1. Foreground-A foreground service performs some operation that is noticeable to the user. Start Service()
2. Background-A background service performs an operation that isn't directly noticed by the user. Start Service()
3. Bound-A service is bound when an application component binds to it by calling bindService(). Abound service offers a client-server interface that allows components to interact with the service, send requests, receive results, and even do so across processes with inter-process communication (IPC). Abound
service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed.
Linux kernel
At the bottom of the layers is Linux -Linux 3.6 with approximately 115 patches. This provides a level of abstraction between the device hardware and it contains all the essential hardware drivers like camera, keypad, display etc. Also, the kernel handles all the things that Linux is really good at such as networking and a vast array of device drivers, which take the pain out of interfacing to peripheral hardware.
Browser
Bluetooth
Animation
A presentation given at GDG Cape Town about how to build a chat app in a very secure and stable way using Firebase.
We used Kotlin and Node.js. From Firebase we used: Realtime Database, Cloud Functions, Notifications, Auth & Storage.
I would like to share an experience of using the recommended Android way to synchronize your application cache. SyncAdapter is very powerful and at the same time seems to be complex.
Along with features & functionality overview I've provided some leads to start using it right away with sample code.
Serverless Design Patterns (London Dev Community)Yan Cui
Serverless technologies like AWS Lambda has drastically simplified the task of building reactive systems - drop a file into S3 and a Lambda function would be triggered to process it, push an event into a Kinesis stream and magically it'll be processed by a Lambda function in real-time, you can even use Lambda to automate the process of auditing and securing your AWS account by automatically reacting to rule violations to your security policy.
Join us in this talk to see some architectural design patterns that have emerged with AWS Lambda, and learn how to pick the right event source based on the tradeoffs you want. Amongst the many patterns we'll explore, here are a few to whet your appetite : pub-sub, cron, push-pull, saga and decoupled invocation.
Similar to Android Whats running in background (20)
5. Services / Threads (war of two worlds)
A service is not an alternative to background threads but it provides
another scope in which to run your worker threads!
• The thread should stay alive, even when the user is not
interacting with the application.
• In addition, a Service can be started from another
application using an Intent.
11. Services
Normal Service
Intent Service [special case of normal service]
Bound Service [in same process]
Bound Service [in separate process-> Messenger]
Bound Service [in separate application-> AIDL]
12. onStartCommand
START_STICKY to automatically restart if killed, to keep it active.
START_REDELIVER_INTENT for auto restart and retry if the service was killed before
stopSelf(). This is needed for services receiving inputs.
START_NOT_STICKY to not automatically restarts if killed, but wait for next
startService() call. For non-essential services.
START_STICKY_COMPATIBILITY with Android 1.6 and earlier legacy onStart()
method.
13. Start Services
• What happens if task is removed from recent?
• What happens if force stop?
• What happens if exception occur in running process?
27. Job Scheduler
❏Introduced in Android 5.0 Lollipop (API 21)
❏When you would use this
- Tasks that should be done once the device is connected to a power supply
- Tasks that require network access or a Wi-Fi connection.
- Task that are not critical or user facing
- Tasks that should be running on a regular basis as batch where the timing is
not critical
28. ❏ Job Scheduler
- Persists the data across device reboots
- Certain criteria can be set
- Service runs when set criteria is available
- Delay can be set
- Use for periodical running task
❏ Alarm Manager
- Broadcast listener to wake up
- Data get lost on device reboot
- Service keeps running until you manually
turns off or system do it for you
- Use for scheduling task at specific time
Editor's Notes
this need to be consider thread is a java object which mostly runs on android component.
Android component has lifecycle java object don’t as such.
there could be possibility of leakage if thread outives android component. Go to diagram
You should always create a separate thread within a service if you are doing something more complicated.
The thread should stay alive, even when the user is not interacting with the application.
In addition, a Service can be started from another application using an Intent.
Performnace issues
Memory issues
Battery drain
Inconsitent data
Shift to code
You need to identify and understand what problem you are facing.
Because there are other tools which might perform the task; before even you start thinking you need your service.
For non sticky service don’t re launch.
For sticky service is re launch with different start id and NULL intent.
For redelivery same start id and previous intent.
Nobody relaunches
Hack use broadcast receiver at onDestroy() but very bad userExperience
sticky restart but intent is null so becomes non sticky
Non sticky don’t restart
Redelivery pass same intent which was sent before
java.lang.ClassCastException: android.os.BinderProxy
at edu.navalkishoreb.androidservices.connectors.LocalConnection.onServiceConnected