7. Doze and App Standby
https://developer.android.com/training/monitoring-device-
state/doze-standby
Doze restrictions
The following restrictions apply to your apps while in Doze:
•Network access is suspended.
•The system ignores wake locks.
•Standard AlarmManager alarms (including setExact() and setWindow())
are deferred to the next maintenance window.
• If you need to set alarms that fire while in Doze,
use setAndAllowWhileIdle() or setExactAndAllowWhileIdle().
• Alarms set with setAlarmClock() continue to fire normally — the
system exits Doze shortly before those alarms fire.
•The system does not perform Wi-Fi scans.
•The system does not allow sync adapters to run.
•The system does not allow JobScheduler to run.
Doze checklist
• If possible, use FCM for downstream messaging.
• If your users must see a notification right away, make sure to use
an FCM high priority message.
• Provide sufficient information within the initial message payload,
so subsequent network access is unnecessary.
• Set critical alarms
with setAndAllowWhileIdle() and setExactAndAllowWhileIdle().
8. Android 7.0 (Nougat) Behaviour Changes
- Doze
API level 24
When a device is on battery power, and the screen has been off
for a certain time, the device enters Doze and applies the first
subset of restrictions: It shuts off app network access, and
defers jobs and syncs
9. Android 7.0 (Nougat) Behaviour Changes
- Doze
API level 24
If the device is stationary for a certain time after entering
Doze, the system applies the rest of the Doze restrictions
to PowerManager.WakeLock, AlarmManager alarms,
GPS, and Wi-Fi scans.
10. Android 8.0 (Oreo) Behaviour Changes
- Background execution limits
- Android background location
limits.
API level 26
•Apps that are running in the background now have
limits on how freely they can access background
services.
•Apps cannot use their manifests to register for most
implicit broadcasts (that is, broadcasts that are not
targeted specifically at the app).
workaround
11. Android (P Preview) Behaviour Changes
- App Standby Bucket
API level 28, full release in Q3
• Active— An application that is currently in use by the user (app in foreground).
• Working Set — An application that is not currently in use but is run quite often,
likely most days. For example, even if for short periods, you’re likely to open the
Twitter app several times a day.
• Frequent— An application that is not currently in use but is sometimes opened
throughout the week. For example, if you go running 3 times a week then the app
you use to track your runs would fall into this.
• Rare— An application that is rarely used on the device. For example, a ride
sharing app that you may only use when you go on Holiday.
• Never— An application that has been installed but never launched.
12. Android (P Preview) Behaviour Changes
- App Standby Bucket
API level 28, full release in Q3
System will use machine learning to determine the
frequency of apps and then these will be placed into
buckets based on those predictions.
• In particular, the bucket determines how frequently the app's jobs
run, how often the app can trigger alarms, and how often the app
can receive high-priority Firebase Cloud
Messaging (FCM) messages.
• help to ensure that system resources are given to the apps that
need them the most.
https://developer.android.com/preview/features/power
17. Model View Controller
How do you test MVC?
And then we can achieve testable
pattern here.
But, Controller still has reference to the
view.
So, you cant test controller by using
jUnit.
34. Model View Intent
Intents represents, name of event, click Foo
Actions defines the logic that should be executed by
the Processor.
Processor simply executes an Action
Results are the result of what have been
executed inside the Processor. Their can be
errors, successful execution
The Reducer is responsible to generate the ViewState
The State contains all the information the View needs to
render itself.
39. Reference
- Object-Oriented Programming in C# Succinctly by Sander Rossel
- Solid Principle by Gaurav Kumar Arora
- Java Design Pattern by Vaskaran Sarcar
- Clean Code by Robert C. Martin
- Effective Java 3rd Edition by Joshua Bloch
- Working with legacy code by Michael C. Feathers
- Refactoring to Patterns by Joshua Kerievsky
- Pragmatic Programmer by Andy Hunt and Dave Thomas
Fundamental
Android
- Android Programming: The Big Nerd Ranch Guide 3rd Edition
- Kotlin in Action by Dmitry Jemerov
- Kotlin for Android Developers by Antonio Leiva
- BDD in Action by John Ferguson Smart
Test