Android battery and memory optimizations - Google I/O 2016
Why Stack Overflow recommends it
Stack Overflow users link it when asking or answering how to schedule background work, handle Doze, and choose between JobScheduler, GcmTaskService and Firebase JobDispatcher.
Recommended by 6 people across 6 different months, 2016 to 2018.
What it is
A Google I/O 2016 session from the Android team on reducing battery drain and memory use in Android apps. It covers Doze, the Android N background optimizations, tools for measuring power consumption, and the APIs (including the Firebase JobDispatcher announcement) for efficient background work.
What people said
Recommends android developer · 2016-06 · Stack Overflow · on “Firebase JobDispatcher - how does it work compared to previous APIs (JobScheduler and GcmTaskService)?”
Background Google has multiple solutions for job/task scheduling, such as JobScheduler and GcmTaskService . Each has its own advantages and disadvantages. Recently, Google presented a new library called "Firebase JobDispatcher". The problem Sadly, there is very little to read about this new API. In fact, it's really hard to find anything about it. Only thing I've found is their announcement video [this video] and a sample [LINK] . But even their, there is not much to know about this API. The questions Looking at previous questions, investigations and comparisons I had with the other APIs ( here [LINK] , for example), I'd like to ask how the new API works and know what to take into consideration w
Recommends cgr · 2016-07 · Stack Overflow · on “How to restart service after the app is killed from recent tasks”
@priyankaChauhan that is expected Priyanka. It does not work from KK.That is why we have to override onTaskRemoved and handle the stuff as in answer. Also try to understand the Doze mode in M and N so that you can write flexible code. Do not miss this video [this video]
Recommends kws · 2016-08 · Stack Overflow · on “Using GoogleAPIClient in Background Services”
I had same problem. I went for the first approach (a sticky service) and everything worked fine. However, I didn't like the fact that the service was always running and visible to the user. That's why I decided to use the JobScheduler API as it's the preferred way of performing background work according to docs [LINK] . If your app targets API>=21 then JobScheduler is the way to go. If you want to support older versions of the platform then you should use the recently introduced Firebase JobDispatcher [LINK] library, which unfortunately lacks of documentation. Everything is explained here [this video] at a Google I/O 2016 presentation. Take a look at it.
Recommends Arturo Mejia · 2017-04 · Stack Overflow · on “FirebaseJobDispatcher run on network change”
JobScheduler [LINK] is a great option when you want to trigger some actions that just happens when some preconditions are made (Connectivity, Battery and System's Broadcasts). In you case schedule some work that only happens when the user has internet connection. You can use JobScheduler [LINK] minimum API 21 and Google Play Service is NOT required . FirebaseJobDispatcher [LINK] minimum API 9 and Play Service is REQUIRED . Additionally AndroidJob [LINK] is a library that has minimum API 14 and does NOT require Play Service . This video can help to clarify some doubts with FirebaseJobDispatcher [this video] and additionally this post by Evernote [LINK] is good resource.
Recommends Mehmed · 2017-09 · Stack Overflow · on “Http request in background with Firebase job dispatcher: asynchronous or synchronous?”
I think I first came across in the I/O presentation link given in the readme: [this video] Answer to 10th question in this answer [LINK] was also helpful.
Recommends Abhishek Luthra · 2018-09 · Stack Overflow · on “How do whatsapp and instant messaging apps work in background without persistent notification in Oreo?”
Starting with Android 6.0 (API level 23), Android introduces two power-saving features that extend battery life for users: DOZE and APP STANDBY . These two features enforce many restrictions on your background processing while the phone is in Doze mode. You should read about Doze and app standby in the following link [LINK] Now, about your use case is that you want to receive the messages and incoming calls even when the app is not running. For this use case, Android announced High Priority FCM messages in GoogleIO2016. They are high priority Push message which grant the application temporary wakelock and network access, independent of Device's Doze state or if the app happens to be in the a
Recommends Abhishek Luthra · 2018-09 · Stack Overflow · on “How to create background services for android Oreo without notifications like social networking applications Facebook, Messenger, Zalo”
Starting with Android 6.0 (API level 23), Android introduces two power-saving features that extend battery life for users: DOZE and APP STANDBY . These two features enforce many restrictions on your background processing while the phone is in Doze mode. You should read about Doze and app standby in the following link [LINK] Now, about your use case is that you want to receive the messages and incoming calls even when the app is not running. For this use case, Android announced High Priority FCM messages in GoogleIO2016. They are high priority Push message which grant the application temporary wakelock and network access, independent of Device's Doze state or if the app happens to be in the a
Cites Henning · 2016-08 · Stack Overflow · on “Is the Firebase JobDispatcher using the JobScheduler?”
Since my App has to be available for Android versions 4.x I cannot rely solely on the JobScheduler for background activity. The Firebase JobDispatcher is backwards compatible with the versions I need, so I tested it a bit. My expectation was, that its using Google Play Services when on Android <5 and the JobScheduler API when 5+, as seen on this slide [this video] from the Android battery and memory optimizations talk on Google I/O 2016. Jobs which I schedule in my own app using the JobDispatcher and the testapp, which comes with the Firebase JobDispatcher, do work. I don't see any activity when calling adb shell dumpsys jobscheduler . When I am using the JobScheduler directly I can see the jobs
Cites lujop · 2016-10 · Stack Overflow · on “Share service between activities and the new android guidelines to deprecate unbounded backgound services”
In Android battery and memory optimizations - Google I/O 2016 [this video] (at 18:46 aprox) it explains that unbound background services aren't going to work in the future. I understand the spirit of that changes to preserve user battery and make the phone responsive and performant. But I've one use case that in spirit is a bounded service but I implement it with an unbounded one. The use case is a service that is "bound to several activities" and it can be destroyed when the activities are not in foreground but it has to be preserved between activity transitions. (For example a service that maintains some shared state and resources that are the same for all activities and it's not nice to recrea
Cites Rajat Sharma · 2017-03 · Stack Overflow · on “Android Doze mode”
It should be noted that Android N has extended doze mode further. Here the device doesn't need to be 'absolutely stationary' for a 'lighter' version of doze - that allows wake locks but restricts network access - to kick in. The principal is that to truly take advantage of this, android needs to conserve battery if the phone is in a user's pocket where it is 'unused' but may not be stationary. The original Marshmallow 'deep-doze' is still very much present in N so once the phone is stationary for a good amount of time [screen off + not being charged are already met criteria] it will go into the original doze where wifi scans and gps scans [location updates], wake locks, job schedulers, sync