No description
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
# Elements of Android R — Reading Guide
## 【One-Line Pitch】
A practical field manual for experienced Android developers navigating the breaking changes and new capabilities introduced in Android 11 (R), with working Kotlin sample code for every major topic. If you maintain Android apps and want to avoid customer complaints when Android 11 rolls out, this book is your pre-flight checklist.
## 【Book Arc】
- **Opening (~0%–10%)**: Introduces the book's scope, prerequisites (1+ years Android experience, Kotlin familiarity), and dives straight into the biggest change—scoped storage evolution from Android 10 to 11, including the new "All Files Access" permission and its caveats.
- **Early (~10%–23%)**: Covers MediaStore modifications, including the deprecated DATA column, the cumbersome RecoverableSecurityException flow for modifying other apps' content, and the new one-time permissions system for CAMERA, LOCATION, and MICROPHONE groups.
- **Early (~23%–32%)**: Explores permission permutations—how multiple rejections lead to automatic denial, background location request flows (with targetSdkVersion 29 vs 30 differences), and introduces data access auditing via AppOpsManager callbacks.
- **Middle (~32%–42%)**: Delves into forensic debugging tools: ApplicationExitInfo for retrieving process exit reasons, ANR trace access via getTraceInputStream(), and how to use these for crash analysis and user support.
- **Middle (~42%–48%)**: Covers Package Visibility—Android 11's "social distancing for apps"—explaining the new `<queries>` manifest element, its restrictions, and how launchers and other apps must adapt to query other installed apps.
## 【Key Takeaways】
- **Scoped storage is now the only game in town** (Early): Android 11 refines Android 10's scoped storage, and the old DATA column in MediaStore is deprecated. Apps must adapt to the new model or risk breaking on modern devices.
- **MANAGE_EXTERNAL_STORAGE is a special permission, not a dangerous one** (Early): Users must grant it via Settings > Special app access, you still can't access Android/data/ on external volumes, and Google will likely restrict Play Store usage—prepare for form-filling and bot-related ban risks.
- **One-time permissions are scoped to your process** (Early): "Only this time" grants for CAMERA, LOCATION, and MICROPHONE persist only while your process lives. If the process dies and restarts after a delay, you'll need to re-request. Your app should already handle this gracefully.
- **Background location requires a Settings detour on targetSdkVersion 30** (Early): When requesting ACCESS_BACKGROUND_LOCATION, users are taken straight to Settings instead of an in-app dialog. Build your own explanatory UI before making the request.
- **Data access auditing via AppOpsManager is your privacy watchdog** (Early): Register an OnOpNotedCallback to log when your app accesses sensitive data like fine location. This helps you verify your own app's behavior and prepare for privacy compliance.
- **ApplicationExitInfo gives you forensic visibility** (Middle): Use getHistoricalProcessExitReasons() to see why your app's processes died, including ANR traces via getTraceInputStream(). This is invaluable for debugging crashes you can't reproduce locally.
- **Package visibility is opt-in, not automatic** (Middle): Android 11 hides other installed apps from your queries by default. Use the `<queries>` element in your manifest to declare what you need to see, with restrictions on intent structure and data attributes.
## 【Reading Tips】
- **Skim the sample code, but study the permission flows**: The book's Kotlin samples are illustrative, but the real value is in the permission request sequences and their variations across targetSdkVersion 29 vs 30. Trace through those carefully.
- **Deep-read the scoped storage chapters first**: Storage changes are the most likely to break existing apps. Understand the "All Files Access" caveats and the SAF (Storage Access Framework) limitations before anything else.
- **Pay attention to the "Ramifications For You" sections**: The author explicitly calls out practical implications for your app. These are gold for prioritization.
- **Don't skip the forensic debugging chapter**: ApplicationExitInfo and ANR traces are underutilized tools that can save you hours of debugging. The sample app (ForensicPathologist) is worth building and running.
- **Watch for version-specific behavior**: The book notes where behavior differs between targetSdkVersion 29 and 30. If you're not ready to bump your target SDK, know what you're missing.
## 【Coverage Limits】
This guide covers the book's first half (storage, permissions, auditing, package visibility). The excerpts do not cover later chapters on background work limits, wireless debugging, or other Android 11 features—those remain unexplored here.
##
Page 8
it may also work with other PDF viewers. Some PDF viewers, for reasons that remain unclear, foul up copying the source code to the clipboard when it is selec...
View in text
Excerpt 2
ersome if you are trying to modify lots of content at once. Your calls on ContentResolver that would require write access — such as delete() or openOutputStr...
View in text
Excerpt 3
anager.OnOpNotedCallback: package com.commonsware.android.r.permcheck import android.app.AppOpsManager import android.app.Application import android.app.Asyn...
View in text
Excerpt 4
p that the other app is installed. And, with Android 11, by default you will not be able to communicate between those apps. In the case from above, the clien...
View in text
Excerpt 5
override fun onServiceDisconnected(name: ComponentName?) { messenger = null } } (from EmbedClient/src/main/java/com/commonsware/android/r/embed/client/MainMo...
View in text
Excerpt 6
ut icon with your app’s launcher icon superimposed upon it: Figure 26: Bubble, As Initially Launched The bubble itself can be dragged around the screen, thou...
View in text
Excerpt 7
telessBuilder(id.toString(), actionPI) .setTitle(title) 104 DEVICE CONTROLS This time, since (in theory) we are delivering results over time, we cannot just...
View in text
Excerpt 8
to decide which of those permissions you need based on API level, and include the correct permission in the array that you pass to requestPermissions(). If t...
View in text
Tags
AI categories
androidProgrammingMobile
Text Preview (First 20 pages)
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Generating text preview…
Loading comments...
Reply to Comment
Edit Comment