Latest / CyberSecurity Summary / Android Application Development Cookbook: Over 100 recipes to help you solve the most common problems faced by Android Developers today
Transcript
- 0:00Speaker 1: Welcome to the Depth Dive, where we take a stack
- 0:02Speaker 1: of information and really extract the most important nuggets of
- 0:06Speaker 1: knowledge and insight tailored just for you. Today, we're doing
- 0:09Speaker 1: something a little different. It's like a fascinating TimewARP. We're
- 0:13Speaker 1: diving into the Android Application Development Cookbook, second edition, which,
- 0:17Speaker 1: believe it or not, was published way back in March
- 0:19Speaker 1: twenty sixteen. Our mission here is basically to give you
- 0:23Speaker 1: a shortcut, a shortcut to understanding what Android app development
- 0:26Speaker 1: looked like, you know, nearly a decade ago. We'll uncover
- 0:29Speaker 1: the core ideas, some practical recipes for problems developers face then,
- 0:34Speaker 1: and maybe some surprising things that we're cutting edge and
- 0:36Speaker 1: see how much or maybe how little things have really changed.
- 0:39Speaker 1: Our main source is that cookbook by Rick Boyer and
- 0:42Speaker 1: Kyle mu It's very much designed for developers who learn
- 0:45Speaker 1: by doing a by jumping into code. It's literally broken
- 0:48Speaker 1: down into these recipes with sections like getting ready, how
- 0:51Speaker 1: to do it, how it works. So let's imagine you're
- 0:54Speaker 1: an Android dep back in twenty sixteen, staring at a
- 0:56Speaker 1: blank screen. What were the absolute first things you'd write?
- 0:59Speaker 1: What were those fundamental building block?
- 1:01Speaker 2: Yeah, it's really interesting looking back, what's fascinating is how
- 1:04Speaker 2: clearly the book lays out these core components that honestly
- 1:08Speaker 2: are still pretty foundational today, even of how we implement
- 1:11Speaker 2: them has evolved quite a bit. The absolute bedrock for
- 1:14Speaker 2: almost any Android app then, and you could argue still now,
- 1:17Speaker 2: were activity activities. Right, Think of an activity as like
- 1:22Speaker 2: a single screen in your app, or a distinct user
- 1:25Speaker 2: interface view every single screen, your main menu settings, a
- 1:28Speaker 2: photo viewer that would typically be its own activity, and
- 1:31Speaker 2: these were all declared in that central file, the Android
- 1:35Speaker 2: Manifest dot XML.
- 1:36Speaker 1: Ah, the manifest okay exactly.
- 1:39Speaker 2: And crucially specific things called intent filters in there, like
- 1:42Speaker 2: main and launcher. They told the system which activity was
- 1:45Speaker 2: the main entry point, you know, the one that gets
- 1:47Speaker 2: the icon on your phone's home screen.
- 1:49Speaker 1: Okay, So activities are like the individual rooms in a house,
- 1:52Speaker 1: and the Manifest is the blueprint saying this room is
- 1:55Speaker 1: the front door. Got it? But how did these rooms
- 1:58Speaker 1: talk to each other inside the same app, or even
- 2:00Speaker 1: like talking to other apps on the phone.
- 2:02Speaker 2: That's where the incredibly powerful intent object came in. It's
- 2:07Speaker 2: essentially a message object. Think of it as a way
- 2:09Speaker 2: to say I want to do something, Yeah, but without
- 2:11Speaker 2: needing to know exactly who we'll do it. So, for example,
- 2:14Speaker 2: you could use intents dot action view. You tell the system, hey,
- 2:17Speaker 2: I want to view this capacity URL maybe huh, and
- 2:21Speaker 2: Android would figure out okay, the default web browser should
- 2:24Speaker 2: handle this and launch it for you.
- 2:26Speaker 1: Right, So the app doesn't need to know which browser
- 2:28Speaker 1: the user has installed exactly.
- 2:30Speaker 2: And what was really clever and still is is that
- 2:33Speaker 2: different types of data could launch completely different apps. A
- 2:36Speaker 2: location might open a map app, a contact file might
- 2:39Speaker 2: open the contact app. It showed how flexible the system
- 2:42Speaker 2: was letting apps work together without hard coding dependencies.
- 2:45Speaker 1: That's huge, that interoperability. Okay, so that's talking between apps.
- 2:49Speaker 1: What about just moving between screens inside your own appic
- 2:53Speaker 1: from a list to a detail screen.
- 2:55Speaker 2: Intents handle that too. You just create an intent specifying
- 2:59Speaker 2: the target activity, say moving from your main activity to
- 3:03Speaker 2: a second activity. As simple as that, And if you
- 3:05Speaker 2: needed to send some information along, you'd use put extra.
- 3:10Speaker 2: It worked with name value pairs, like packing little bits
- 3:13Speaker 2: of data into the intent.
- 3:14Speaker 1: Like sticking a post it note on the message.
- 3:16Speaker 2: Pretty much yeah, exactly like a post it and the
- 3:19Speaker 2: receiving activity would just grab that data using methods like
- 3:23Speaker 2: get string extra looking for the name you give it.
- 3:25Speaker 1: Okay, And what if you needed to get something back
- 3:28Speaker 1: from that second screen. Let's say you launched a contact
- 3:31Speaker 1: picker and you need the phone number the user picked.
- 3:34Speaker 2: Ah, right, for that, you wouldn't just start the activity.
- 3:37Speaker 2: You'd use start activity for results the result makes sense,
- 3:41Speaker 2: and the result would come back to the original activity
- 3:44Speaker 2: in a special callback method on activity results. And for
- 3:49Speaker 2: apps doing lots of this, maybe calling different activities for results,
- 3:53Speaker 2: there was something called a request code. There's a number
- 3:55Speaker 2: you defined when you started the activity, so that when
- 3:58Speaker 2: on activity result was called, you could check that code
- 4:01Speaker 2: and know which request was returing its result. Kept things organized, right,
- 4:05Speaker 2: because the mobile world is just so dynamic, isn't it.
- 4:08Speaker 2: You're in an app, a phone call comes in, you
- 4:10Speaker 2: switch to another app, The system might even kill your
- 4:13Speaker 2: app in the background, off the needs memory. It feels
- 4:15Speaker 2: like a constant battle with the OS. So what did
- 4:18Speaker 2: this all mean for a developer trying to make an
- 4:20Speaker 2: app feel smooth and seamless even with all those interruptions.
- 4:24Speaker 1: That's the million dollar question really, and connecting this to
- 4:28Speaker 1: the bigger picture, understanding the activity life cycle was just
- 4:30Speaker 1: absolutely critical paramount for app stability user experience, especially back
- 4:35Speaker 1: then on devices that maybe didn't have tons of memory.
- 4:39Speaker 1: Think about this, just rotating your phone. Yeah, by default,
- 4:43Speaker 1: Android would completely destroy your current activity and then recreate
- 4:46Speaker 1: it from a scratch.
- 4:46Speaker 2: Wait, destroy it just for rotating?
- 4:48Speaker 1: Yeah, destroy and recreate, which, as you can imagine, could
- 4:51Speaker 1: lead to a really terrible user experience if you weren't
- 4:54Speaker 1: ready for it. All the user's input gone, the scroll
- 4:57Speaker 1: position lost.
- 4:58Speaker 2: Wow. Okay, so how did developers handle that? That's where
- 5:01Speaker 2: these life cycle callback methods were vital, Things like on
- 5:04Speaker 2: save instance state and on restore instance. On save instance
- 5:08Speaker 2: date gave you a chance right before the activity was
- 5:10Speaker 2: potentially destroyed to save small bits of data like user
- 5:14Speaker 2: input or UI state okay, And then if the activity
- 5:17Speaker 2: was recreated on restore instance state or on create what
- 5:21Speaker 2: would be called and you could get that save data
- 5:23Speaker 2: back and restore the state so the user could just
- 5:25Speaker 2: pick up where they left off.
- 5:27Speaker 1: So you had to manually save and restore anything important
- 5:29Speaker 1: every time a configuration might change, like rotation.
- 5:32Speaker 2: Pretty much.
- 5:32Speaker 1: Yes.
- 5:33Speaker 2: The book details the core life cycle states active, pause, stopped, destroyed,
- 5:39Speaker 2: and the methods tied to them. On create on resume,
- 5:42Speaker 2: on pause, on stop, on destroy. The US was described
- 5:46Speaker 2: as ruthless with resource management. If your app went into
- 5:50Speaker 2: the pause or stop state, it was fair game for
- 5:52Speaker 2: the OS to kill it to reclaim memory.
- 5:54Speaker 1: That sounds like a lot of manual work and potential
- 5:56Speaker 1: for bugs.
- 5:57Speaker 2: It absolutely was a major source of frustration. Bilbote's got
- 6:01Speaker 2: to be really careful about calling the superclass methods, understanding
- 6:05Speaker 2: when each callback fired what they could safely do in
- 6:08Speaker 2: each one. It's honestly one of the main reasons modern
- 6:11Speaker 2: Android development shifted towards things like view model from the
- 6:14Speaker 2: architecture components.
- 6:15Speaker 1: Right to abstract away some of that life cycle complexity exactly.
- 6:19Speaker 2: View models survive configuration changes like rotation, automatically holding UI
- 6:24Speaker 2: related data without you needing to manually save and restore
- 6:27Speaker 2: it in the activity nearly as much. It simplified things massively.
- 6:31Speaker 1: Okay, so we've got the basic structure with activities and
- 6:34Speaker 1: intents and a sense of the constant dance with the
- 6:36Speaker 1: OS life cycle. But an app is nothing without its interface.
- 6:41Speaker 1: This is where it gets really interesting, right, optimizing what
- 6:44Speaker 1: the user actually sees and interacts with. It's not just
- 6:47Speaker 1: what you put on screen, but how you put.
- 6:49Speaker 2: It there absolutely, and that raises the question, how do
- 6:52Speaker 2: you build a complex, good looking UI that still performs well,
- 6:57Speaker 2: especially considering the huge variety of Android devices out there.
- 7:00Speaker 2: Even back then, the techniques in the cookbook, even from
- 7:03Speaker 2: twenty sixteen, really emphasize that performance starts with design, and
- 7:08Speaker 2: the foundation of UI design was layouts and view.
- 7:10Speaker 1: Groups w groups. That's like a container precisely.
- 7:13Speaker 2: A view group is the base class for containers, and
- 7:16Speaker 2: layout classes, which inherit from view group, are what you
- 7:19Speaker 2: use to actually organize the UI elements, the buttons, the
- 7:22Speaker 2: text fields, the images. They define the structure.
- 7:25Speaker 1: What were the main layout types developers were using back then?
- 7:28Speaker 2: The book covers several key ones. Relative layout was really powerful.
- 7:32Speaker 2: It let you position views relative to each other or
- 7:35Speaker 2: relative to the parent container. You could say, this button
- 7:37Speaker 2: goes to the right of that text view or center
- 7:40Speaker 2: this image. Very flexible for complex screens. Okay, yeah, Linear
- 7:43Speaker 2: layout much simpler. It just arranged views one after another,
- 7:47Speaker 2: either vertically in a column or horizontally in a row.
- 7:50Speaker 1: Simple but probably useful, very and.
- 7:53Speaker 2: Its key feature was layout weight. This allowed views within
- 7:56Speaker 2: the linear layout to take up proportional space. Like one
- 8:00Speaker 2: element takes seventy percent of the width, the other takes
- 8:02Speaker 2: thirty percent. Super useful for dividing space.
- 8:05Speaker 1: Dynamically right and for grids like a calculator or a
- 8:08Speaker 1: photo gallery.
- 8:09Speaker 2: For grid like structures, there was table layout and grid layout.
- 8:12Speaker 2: They approached it slightly differently how they defined rows and columns,
- 8:16Speaker 2: but both serve that purpose. And of course you could
- 8:19Speaker 2: nest these layouts, put a linear layout inside a relative
- 8:22Speaker 2: layout inside another linear layout. That's how you built up
- 8:26Speaker 2: really complex UI hierarchies.
- 8:28Speaker 1: But nesting sounds like it could get complicated fast and
- 8:31Speaker 1: maybe slow things down. Were there tools to help optimize
- 8:34Speaker 1: these layouts?
- 8:34Speaker 2: You bet? Performance was definitely a concern. The cookbook highlights
- 8:38Speaker 2: a couple of essential tools from that era. First, the
- 8:40Speaker 2: hierarchy Viewer hierarchy veer. Yeah, there's a tool that let
- 8:43Speaker 2: you visually inspect your layout structure as a tree. You
- 8:46Speaker 2: could see how deeply nested things were, identify redundant layouts.
- 8:49Speaker 2: Super useful for fine bottlenecks. The catch was, back then
- 8:53Speaker 2: it usually required a rooted device or an emulator to
- 8:55Speaker 2: use it.
- 8:56Speaker 1: Ah, okay, bit of a hurdle.
- 8:57Speaker 2: A bit, yeah, But then there was lint. Lint was
- 9:00Speaker 2: and still is part of the Android SDK integrated into
- 9:04Speaker 2: Android Studio. Think of it as like a static code analyzer,
- 9:08Speaker 2: but specifically for androids.
- 9:09Speaker 1: So it would warn you about problems exactly.
- 9:12Speaker 2: It would flag potential layout issues automatically, things like deep layouts,
- 9:16Speaker 2: warning you if your view hierarchy was nested too many
- 9:19Speaker 2: levels deep which killed performance, or nested weights in linear layouts,
- 9:24Speaker 2: another notorious performance trap. It also flagged things like useless
- 9:28Speaker 2: parent layouts or useless leaf views that weren't contributing anything
- 9:32Speaker 2: really helpful for keeping UIs lean.
- 9:34Speaker 1: And what if you had a part of the UI
- 9:35Speaker 1: that was complex but maybe wasn't used very often, like
- 9:39Speaker 1: a detailed error message panel. Was there a way to
- 9:41Speaker 1: avoid loading that all the time?
- 9:43Speaker 2: Yes, that's where view stub came in. It was described
- 9:45Speaker 2: as a lazy load mechanism. Basically, it was a placeholder
- 9:48Speaker 2: in your layout. This very lightweight took up almost no
- 9:51Speaker 2: memory or inflation time initially only when you explicitly told
- 9:55Speaker 2: the view stub to inflate, usually in your code, when
- 9:58Speaker 2: that specific UI was actually needed. Would it load the
- 10:01Speaker 2: real more complex layout it was referencing great for reducing
- 10:05Speaker 2: initial screen load time and memory usage for rarely seeing
- 10:08Speaker 2: UI components clever.
- 10:10Speaker 1: Okay, so that's the structure. What about the actual things
- 10:13Speaker 1: the user sees and taps on? The widgets?
- 10:15Speaker 2: Right, the views and widgets. The book mentions all the
- 10:18Speaker 2: common built in ones you'd expect text view for text, button, checkbox,
- 10:22Speaker 2: even things like clock, date, picker, calendar, A whole toolbox
- 10:26Speaker 2: of standard UI elements.
- 10:28Speaker 1: But could you make your own if the standard ones
- 10:30Speaker 1: weren't enough.
- 10:31Speaker 2: Absolutely, customization was key. You could extend an existing widget
- 10:35Speaker 2: to add functionality, or you could create a totally custom
- 10:38Speaker 2: view from scratch by extending the base view class. Doing
- 10:41Speaker 2: that often meant you had to get your hands dirty
- 10:43Speaker 2: overwriting methods like on measure to tell Android how big
- 10:46Speaker 2: your custom view should be, and on draw to actually
- 10:49Speaker 2: draw its appearance on the screen. Using the canvas.
- 10:51Speaker 1: API sounds like more work, but powerful.
- 10:54Speaker 2: Definitely more work, but it gave you complete control. Another
- 10:58Speaker 2: common technique mentioned was creating compound controls. This just meant
- 11:02Speaker 2: grouping several existing controls together into a single reusable component,
- 11:06Speaker 2: like creating a custom search bar widget made up of
- 11:09Speaker 2: a text view and a button.
- 11:10Speaker 1: Okay, so you build a layout, put the widgets in,
- 11:13Speaker 1: but then you need consistent styling, right colors, font sizes.
- 11:17Speaker 1: How is that handled?
- 11:18Speaker 2: That's where styles and themes came in. They were crucial
- 11:20Speaker 2: for maintainability and achieving a consistent look and feel. Styles
- 11:25Speaker 2: were defined in an XML file, usually styles dot XML.
- 11:28Speaker 2: A style was basically a collection of attributes like android
- 11:31Speaker 2: dot layout with android dot background, android dot text color,
- 11:34Speaker 2: android dot text size. You could define a style once
- 11:38Speaker 2: like a CSS class, exactly like a CSS class to
- 11:41Speaker 2: define it once, then apply that style to multiple views button, textview, etc.
- 11:45Speaker 2: In your layouts. So if you needed to change the
- 11:47Speaker 2: standard button color across your app, you just changed it
- 11:49Speaker 2: in the style definition, not on every single button.
- 11:52Speaker 1: Much cleaner in themes, How are they different?
- 11:54Speaker 2: Themes were broader. They applied to an entire activity or
- 11:57Speaker 2: even the whole application, rather than individual views. Themes affected
- 12:02Speaker 2: things like the default appearance of standard widgets or window
- 12:05Speaker 2: attributes like the status bar color, or whether the activity
- 12:08Speaker 2: had a title bar or an action bar. You could
- 12:11Speaker 2: even use a theme to make an activity look like
- 12:13Speaker 2: a floating dialogue box, for instance.
- 12:15Speaker 1: And dealing with different Android versions was a big thing
- 12:17Speaker 1: back then, right with Holo themes the material design coming in.
- 12:21Speaker 1: How did themes handle that?
- 12:22Speaker 2: Yeah, that was a major challenge, the fragmentation. The book
- 12:25Speaker 2: explains how developers used resource qualifiers. You could define different
- 12:30Speaker 2: theme versions and folders like values v eleven for Android
- 12:33Speaker 2: three point zero Honeycomb which introduced the Holo theme, or
- 12:37Speaker 2: values v twenty one for Android five point Oho Lollipop
- 12:40Speaker 2: with material design.
- 12:41Speaker 1: Ah, so the system would automatically pick the right one
- 12:44Speaker 1: based on the device's Android version.
- 12:46Speaker 2: Correct, the system handles selecting the most appropriate resources. But
- 12:50Speaker 2: even more importantly, the app compat library was absolutely essential.
- 12:54Speaker 2: It was a support library from Google that backpoorded newer
- 12:58Speaker 2: UI elements and theme features like the action bar and
- 13:01Speaker 2: material design components to older Android.
- 13:04Speaker 1: Versions, so you could use newer features without dropping support
- 13:08Speaker 1: for older phones exactly.
- 13:10Speaker 2: App Compat was a lifeline for developers trying to provide
- 13:13Speaker 2: a reasonably consistent and modern looking UI across that fragmented landscape.
- 13:18Speaker 2: It smoothed over a lot of the version differences.
- 13:20Speaker 1: Okay, so building on that, the app looks good, it's structured, well,
- 13:24Speaker 1: now it needs to actually respond to the user in
- 13:26Speaker 1: smart ways, provide feedback guide them. What were the standard
- 13:30Speaker 1: ways to handle interaction like menus and alerts.
- 13:32Speaker 2: Right. This is where the user experience really starts to
- 13:35Speaker 2: take shape, making the app feel interactive and intuitive. The
- 13:39Speaker 2: cookbook dies into several key areas here, starting with menu systems.
- 13:43Speaker 2: Menus were and still are a fundamental way to provide
- 13:46Speaker 2: options and actions to the user.
- 13:48Speaker 1: What were the main kinds of menus available back in
- 13:50Speaker 1: twenty sixteen, Well, the main.
- 13:51Speaker 2: One was the options menu. That's the standard menu, typically
- 13:54Speaker 2: appearing in the action bar at the top of the screen.
- 13:57Speaker 2: If there wasn't enough space, items would go into that
- 14:00Speaker 2: familiar three dot overflow menu.
- 14:01Speaker 1: Okay, the standard stuff.
- 14:03Speaker 2: Yeah. Developers used XML attributes like show as action to
- 14:07Speaker 2: suggest whether an item should appear directly in the bar
- 14:10Speaker 2: bedroom or always being the overflow never. Then there was
- 14:13Speaker 2: contextual mode or Contextual Action Mode CM. This was seen
- 14:18Speaker 2: as a big improvement introduced around Android three point zero.
- 14:22Speaker 2: You typically trigger it with a long press on an
- 14:24Speaker 2: item like a list item or some text.
- 14:27Speaker 1: Ah like a right click on desktop.
- 14:28Speaker 2: Exactly like a right click, it would bring up a
- 14:31Speaker 2: temporary action bar at the top with action specific to
- 14:33Speaker 2: the item or items you selected. It supported selecting multiple
- 14:37Speaker 2: items too, for batch actions. Like deleting multiple emails. Way
- 14:41Speaker 2: better than the older floating context menus.
- 14:43Speaker 1: Okay, that sounds useful any other menu types.
- 14:45Speaker 2: There was also the pop up menu. This was simpler,
- 14:48Speaker 2: just a little menu that pops up, often anchored to
- 14:51Speaker 2: a specific view, providing some extra actions. It wasn't necessarily
- 14:55Speaker 2: tied to acting on the view that triggered it, more
- 14:58Speaker 2: like providing related options in nearby, like a spinner, but
- 15:01Speaker 2: in a menu format.
- 15:02Speaker 1: Got it. So beyond menus for explicit actions, how did
- 15:06Speaker 1: apps grab the user's attention or give quick feedback without
- 15:09Speaker 1: being too disruptive?
- 15:10Speaker 2: For that, you had various alerts and notifications. For immediate
- 15:13Speaker 2: physical feedback. Apps could use the vibrator service to make
- 15:16Speaker 2: the phone vibrate simple enough, or play sounds using the
- 15:19Speaker 2: ringtone manager to pla say, the default notification sound. The
- 15:23Speaker 2: book even mentions a newer API twenty three feature set
- 15:27Speaker 2: torch mode to flash the camera light briefly as an alert.
- 15:30Speaker 1: Using the flashlight for alerts.
- 15:32Speaker 2: That's novel, Yeah, a bit unusual, but shows the kind
- 15:35Speaker 2: of low level control you had for quick non blocking messages.
- 15:39Speaker 2: Toasts or the standard toasts.
- 15:41Speaker 1: Right, those little gray boxes that pop up briefly at
- 15:43Speaker 1: the bottom exactly.
- 15:45Speaker 2: They'd show a short text message and then fade away, simple, unobtrusive.
- 15:49Speaker 2: You could even customize their layout if you wanted something fancier.
- 15:52Speaker 1: Than just text, and for messages that needed a user
- 15:55Speaker 1: response like a confirmation.
- 15:57Speaker 2: That's where alert dialogue came in the classic message box.
- 16:01Speaker 2: You could create dialogues with a title, a message, and
- 16:04Speaker 2: up to three standard buttons positive, negative, neutral like yes,
- 16:08Speaker 2: no cancel. You could also add icons or even put
- 16:11Speaker 2: lists inside them single choice lists, multi choice lists, or
- 16:15Speaker 2: embed a completely custom layout if needed. Very flexible.
- 16:18Speaker 1: What about showing progress like if something was loading.
- 16:22Speaker 2: There was progress dialogue. It showed a spinning wheel or
- 16:25Speaker 2: a progress bar, typically indicating loading or some indeterminate task. However,
- 16:29Speaker 2: the cookbook explicitly advised developers to avoid progress dialogue if possible.
- 16:34Speaker 1: Why I avoid it.
- 16:35Speaker 2: Because it was modal. It blocked the user from interacting
- 16:38Speaker 2: with the rest of the app until it was dismissed,
- 16:41Speaker 2: which could be really frustrating if the task took a while.
- 16:44Speaker 2: The recommendation was to integrate a progress bar directly into
- 16:46Speaker 2: your apps layout instead, so the user could still interact
- 16:49Speaker 2: with other parts of the UI. Wall waiting.
- 16:51Speaker 1: That's a key usability point even back then. Okay, so
- 16:54Speaker 1: that's in app alerts. What about the system notifications, the
- 16:58Speaker 1: ones that appear in the notification.
- 17:00Speaker 2: Drawer, Ah notifications. Yeah, super important for engaging users when
- 17:04Speaker 2: the app wasn't in the foreground. Developers built these using
- 17:08Speaker 2: notification compat builder. That compact part signifies it came from
- 17:12Speaker 2: the support library, helping ensure compatibility across different Android versions.
- 17:16Speaker 2: You'd set things like a small icon, a title, the
- 17:19Speaker 2: main content text, and.
- 17:20Speaker 1: Could you add buttons to notifications like reply or archive?
- 17:24Speaker 2: Yes? Absolutely, you could add action buttons using something called
- 17:27Speaker 2: pending intent. A pending intent is basically a token that
- 17:31Speaker 2: you give to the Android system. It wraps an intent
- 17:34Speaker 2: and grants the system permission to send that intent on
- 17:36Speaker 2: your app's behalf at a later time, even if your
- 17:39Speaker 2: app isn't running.
- 17:40Speaker 1: So the notification itself could trigger an action in your
- 17:42Speaker 1: app securely exactly.
- 17:45Speaker 2: It's how notification actions worked. Clicking a reply button might
- 17:48Speaker 2: launch a specific activity in your app, or trigger a
- 17:51Speaker 2: background service to handle the reply. Later Android versions added
- 17:55Speaker 2: more features like expanded notifications. Android four point one plus
- 18:00Speaker 2: could show more content, like a longer text snippet or
- 18:02Speaker 2: an image using set style, and Android five point zero
- 18:06Speaker 2: brought specialized styles like media player notifications with playback controls,
- 18:10Speaker 2: though the book notes this wasn't in the compat library yet,
- 18:14Speaker 2: and also heads up notifications.
- 18:16Speaker 1: Oh those ones that pop up over everything.
- 18:17Speaker 2: Yeah, the really intrusive ones. They appeared on top of
- 18:20Speaker 2: whatever app you were using. They were reserved for high
- 18:22Speaker 2: priority things and required setting priority macs and usually having
- 18:25Speaker 2: a sound or vibration to trigger them. You sparingly definitely.
- 18:29Speaker 1: Okay, so we've got menus, alerts, notifications. What about handling
- 18:34Speaker 1: direct touch on the screen and tapping into all those
- 18:36Speaker 1: sensors phones have, right.
- 18:38Speaker 2: Making the app physically responsive. The book covers touchscreen and
- 18:41Speaker 2: sensors quite well. For the basics simple clicks and long
- 18:45Speaker 2: presses you'd use on click listener and on long click listener.
- 18:48Speaker 2: You can set these up in your Java colon code
- 18:51Speaker 2: or even directly in the XML layout using the Android
- 18:54Speaker 2: dot on click attribute. For simple cases, any of you
- 18:57Speaker 2: could have these listeners.
- 18:58Speaker 1: And for more complex gestures swiping, pinching.
- 19:02Speaker 2: For common gestures like detecting swipes, flings, double taps, single taps,
- 19:07Speaker 2: the gesture detector compact class from the support library was
- 19:10Speaker 2: the way to go. It's simplified detecting these standard motions
- 19:14Speaker 2: for multi touch, specifically pinched to zoom, there was scale
- 19:18Speaker 2: gesture detector. It would track two fingers and provide you
- 19:21Speaker 2: with a scale factor indicating how much the user was
- 19:23Speaker 2: trying to zoom in or out. You'd then use that
- 19:26Speaker 2: factor to resize an image or map for example.
- 19:28Speaker 1: Okay, and that common pattern pulling down to refresh a list.
- 19:32Speaker 2: Ah, yes, swipe to refresh. That was made much easier
- 19:35Speaker 2: with the swipe refreshed layout widget. You just wrap your
- 19:37Speaker 2: list view like a blist view or recycle view inside
- 19:40Speaker 2: this layout, set up a listener and it would handle
- 19:43Speaker 2: detecting the pull gester and showing the standard refresh indicator
- 19:47Speaker 2: for you much less boilerplate code.
- 19:49Speaker 1: Nice. Now beyond the screen, what about sensors, accelerometer, compass.
- 19:54Speaker 2: Yeah, The Android sensor framework opened up a lot of
- 19:57Speaker 2: possibilities for context to wear apps. First, you could query
- 20:00Speaker 2: the sensor manager to see what sensors were actually available
- 20:03Speaker 2: on the specific device accelerometer, gyroscope, light sensor, magnetic field sensor,
- 20:08Speaker 2: proximity sensor, et cetera. Not all devices had all sensors right,
- 20:11Speaker 2: you had to check first definitely. Then to get data,
- 20:15Speaker 2: you'd register a sensor event listener. This listener has a
- 20:18Speaker 2: callback method on sensor changed, which gets called repeatedly by
- 20:22Speaker 2: the system whenever there's a new sensor data. It provides
- 20:25Speaker 2: a sensor event object containing the actual values.
- 20:28Speaker 1: And the cookbook had an example.
- 20:30Speaker 2: It did a really neat one creating a simple compass.
- 20:33Speaker 2: It showed how to get data from both the magnetic
- 20:35Speaker 2: field sensor and the accelerometer. Then you'd use methods like
- 20:40Speaker 2: sensor manager dot get rotation matrix and sensor manager dot
- 20:43Speaker 2: get orientation to combine that data and calculate the device's
- 20:47Speaker 2: orientation relative to magnetic.
- 20:49Speaker 1: North and use that to rotate a compass needle image.
- 20:52Speaker 2: Exactly, you'd update the rotation of an image view showing
- 20:55Speaker 2: a compass needle based on the calculated orientation angles. A
- 20:58Speaker 2: great practical example of you use using sensor.
- 21:00Speaker 1: Fusion cool and finally just basic device orientation portrait versus landscape.
- 21:05Speaker 2: Yep. You can easily check the current configuration for configuration
- 21:08Speaker 2: dot orientation landscape or orientation portrait. The book also mentioned
- 21:13Speaker 2: using Android dot config changes in the manifest to prevent
- 21:16Speaker 2: the default activity recreation on orientation changes, but strongly cautioned
- 21:20Speaker 2: that this was usually not the right approach. It was
- 21:23Speaker 2: better to handle the recreation properly with state.
- 21:25Speaker 1: Saving right avoiding the life cycle rather than handling it.
- 21:29Speaker 2: Got it.
- 21:30Speaker 1: Okay, we've covered a huge amount on the UI and interaction,
- 21:33Speaker 1: but apps need data and they need to connect. This
- 21:37Speaker 1: next bit seems crucial. How did developers manage data storage
- 21:41Speaker 1: and network communication back in twenty sixteen? It sounds complex,
- 21:45Speaker 1: It really was, and.
- 21:46Speaker 2: This segment highlights the challenge of doing it efficiently and
- 21:49Speaker 2: reliably on mobile and reads the question how do these
- 21:52Speaker 2: cookbook solutions scale? The book lays out the main data
- 21:56Speaker 2: storage options available.
- 21:57Speaker 1: Then what were they?
- 21:58Speaker 2: First? You had shared preferences, super simple key value storage
- 22:02Speaker 2: for private primitive data I think user settings, maybe log
- 22:05Speaker 2: in token, easy to use for small bits.
- 22:07Speaker 1: Of data, okay, like a little settings file exactly.
- 22:10Speaker 2: Then internal storage. This was for saving private files directly
- 22:14Speaker 2: to the device's internal memory. Other apps couldn't access these files,
- 22:18Speaker 2: and they got deleted automatically if the user uninstalled your app.
- 22:22Speaker 2: The downside usually less space available compared to external storage,
- 22:26Speaker 2: but it's always there.
- 22:27Speaker 1: And external storage the SD card usually.
- 22:29Speaker 2: Right or simulated external storage. This was for files you
- 22:32Speaker 2: might want the user to access directly, or larger files
- 22:36Speaker 2: could be public or private within your app specific external folder.
- 22:40Speaker 2: The big caveat external storage might not always be available.
- 22:44Speaker 2: If the user mounted the device as USD storage on
- 22:47Speaker 2: a computer or move the SD card, your app couldn't
- 22:50Speaker 2: access it. You always had to check its.
- 22:52Speaker 1: State permissions needed for that too.
- 22:54Speaker 2: I bet write external storage and re external storage.
- 22:57Speaker 1: Okay, what about more structured data, not just key value pairs.
- 23:01Speaker 2: That's where squad database came in. Android has built in
- 23:04Speaker 2: support for Squily. It provided a private relational database for
- 23:08Speaker 2: your app. Great for storing lots of structured data, contacts, inventory,
- 23:12Speaker 2: game scores, anything complex. You could even expose this data
- 23:15Speaker 2: to other apps securely using something called the content provider,
- 23:19Speaker 2: but mostly it was for internal app data.
- 23:21Speaker 1: The standard for local databases then.
- 23:23Speaker 2: Yeah. Lastly, lastly, the book broadly mentions cloud storage, basically
- 23:27Speaker 2: saving data off the device, either to your own private
- 23:30Speaker 2: servers or using third party cloud service providers.
- 23:33Speaker 1: Gotcha, So focusing on files for a moment, how did
- 23:37Speaker 1: developers actually read and write files? Maybe manage temporary data?
- 23:41Speaker 2: Standard java file io, mostly using file input stream. File
- 23:45Speaker 2: input stream often wrapped with buffer reader or print writer
- 23:48Speaker 2: for text files. The cookbook showed examples for both internal
- 23:52Speaker 2: and external storage. For temporary data, there was a dedicated
- 23:55Speaker 2: cash directory you could get via getcash dear. The idea
- 23:59Speaker 2: was you put temporary files here, and the Android system
- 24:02Speaker 2: was free to delete these files if the device started
- 24:05Speaker 2: running low on storage, so you couldn't rely on cash
- 24:08Speaker 2: files persisting important distinction.
- 24:10Speaker 1: What about including files directly in the app package, like
- 24:13Speaker 1: audio clips or maybe some data files?
- 24:15Speaker 2: Two main ways for that. You could put files in
- 24:16Speaker 2: the reservo folder. These were treated like other resources. They
- 24:19Speaker 2: got a resource ID or brought up idio. Android verified
- 24:23Speaker 2: the existed a compile time, and you access them via
- 24:25Speaker 2: that ID. Good for things like media files okay, and
- 24:28Speaker 2: the other way the assets folder. Files placed here were
- 24:31Speaker 2: compiled into the APK as well, but they didn't get
- 24:34Speaker 2: resource IDs. You access them more like a traditional filesystem,
- 24:37Speaker 2: using their file names via the asset manager. This was
- 24:41Speaker 2: useful if you needed to access files by dynamically generated names,
- 24:44Speaker 2: or if you were using a library that expected filepaths
- 24:47Speaker 2: instead of resource IDs. The trade off was less compile
- 24:50Speaker 2: time safety.
- 24:51Speaker 1: Right. Okay, let's dive deeper into secollite. That seems like
- 24:54Speaker 1: a core piece. How did the cookbook approach actually using
- 24:58Speaker 1: the database, creating adding data?
- 25:01Speaker 2: It focused heavily on the practical cr rout operations create, read, update, delete.
- 25:07Speaker 2: The main tool for managing the database was the slee
- 25:09Speaker 2: out open helper class.
- 25:10Speaker 1: That's quite open helper It's subclass.
- 25:12Speaker 2: This helper it had methods like on create, where you'd
- 25:15Speaker 2: define your initial database schema that create table statements, and
- 25:19Speaker 2: on upgrade, where you'd put logic to handle migrating data
- 25:22Speaker 2: if you change your schema in a future app update.
- 25:24Speaker 2: This was managed by incrementing the database version constant ah.
- 25:28Speaker 1: Managing those schema changes is always.
- 25:29Speaker 2: Tricky, always. The helper simplified it somewhat. The cookbook used
- 25:34Speaker 2: a simple dictionary database example words and definitions to show
- 25:37Speaker 2: how to insert new words, query for definitions, update entries,
- 25:41Speaker 2: and delete them using methods on the squad day database
- 25:44Speaker 2: object you got from the helper. It also pointed out
- 25:47Speaker 2: an important convention, including an integer primary key column named ID.
- 25:52Speaker 2: This wasn't strictly required by Scorelight, but many Android framework classes,
- 25:56Speaker 2: especially UI adapters like simple cursor adapter expected it, so
- 26:00Speaker 2: it was best practice.
- 26:01Speaker 1: Good tip. Now, database queries can be slow. Doing that
- 26:04Speaker 1: on the main UI thread is bad right leads to freezes.
- 26:07Speaker 2: Absolutely a cardinal sin and and or development. Blocking the
- 26:10Speaker 2: main thread leads to sluggishness and potentially the dreaded application
- 26:13Speaker 2: not responding anur dialogue.
- 26:15Speaker 1: So how did they handle background database access cleanly? Back then, the.
- 26:19Speaker 2: Recommended approach in the cookbook, especially for loading data to
- 26:22Speaker 2: display in the UI, was using loaders, yes, specifically cursor
- 26:26Speaker 2: loader for database queries. Loaders were part of the Android
- 26:30Speaker 2: framework designed to simplify asynchronous data loading. The big benefits
- 26:34Speaker 2: were they automatically performed the database query on a background thread,
- 26:39Speaker 2: so the UI thread wasn't blocked, and if you were
- 26:42Speaker 2: using them with a content provider, they could automatically monitor
- 26:45Speaker 2: the underlying data source for changes and reload the data
- 26:48Speaker 2: to update the UI, although without a content provider you
- 26:51Speaker 2: might need to manually trigger a reload.
- 26:54Speaker 1: So they handled the background thread and delivering results back
- 26:56Speaker 1: to the UI thread exactly.
- 26:58Speaker 2: You'd implement loadermanager dot loader callbacks. The on create loader
- 27:02Speaker 2: method would create and return your cursor latter specifying the query.
- 27:05Speaker 2: The loader did the work in the background. Then the
- 27:08Speaker 2: onload finished callback, which ran on the UI thread, would
- 27:11Speaker 2: deliver the resulting data a cursor in this case, ready
- 27:14Speaker 2: for you to update your UI adapter. It abstracted away
- 27:17Speaker 2: a lot of the threading complexity.
- 27:18Speaker 1: Okay, that sounds much better than raw threads shifting gears.
- 27:22Speaker 1: Now to communication off the device, what about interacting with
- 27:26Speaker 1: phone features like calls and SMS.
- 27:28Speaker 2: Apps could definitely do that, though it required specific permissions.
- 27:32Speaker 2: For making a phone call, you'd use an intent with
- 27:35Speaker 2: the ax that you would call action and the phone number.
- 27:37Speaker 2: Pretty straightforward, but needed the gellphone permission.
- 27:40Speaker 1: And could you listen for call events like know when
- 27:43Speaker 1: a call ends.
- 27:44Speaker 2: Yes, you could create a phone state listener and register
- 27:47Speaker 2: it with the Telephony Manager. This listener had callbacks for
- 27:51Speaker 2: various state changes, including running off hook and IDOL call ended.
- 27:56Speaker 1: Okay.
- 27:56Speaker 2: Sending SMS for SMS, you'd use the SIMS manager get
- 28:00Speaker 2: the default instance, then call, send text message, passing the
- 28:03Speaker 2: destination number, message body, etc. Required the send SMS permission.
- 28:08Speaker 2: The book even mentioned handling long messages using divide.
- 28:11Speaker 1: Message and receiving SMS.
- 28:13Speaker 2: That involves setting up a broadcast receiver You'd declare it
- 28:15Speaker 2: in your manifest with an intent filter for the Android
- 28:18Speaker 2: Dot provider telefany dot SMS received action and request the
- 28:22Speaker 2: receives MS permission. When an SMS arrived, your receiver's on
- 28:25Speaker 2: receive method would be called with the message details. Pretty
- 28:29Speaker 2: low level access to core functions definitely okay.
- 28:32Speaker 1: Broader network stuff displaying web content or checking if the
- 28:35Speaker 1: phone is online.
- 28:36Speaker 2: Web and network communication yeah. Essential for just displaying web
- 28:39Speaker 2: pages within your app. WebView is the component you could
- 28:42Speaker 2: load URLs, html, strings, whatever. A key part was using
- 28:46Speaker 2: a WebView client. By setting your own client, you could
- 28:49Speaker 2: intercept page navigation. For example, you could force links clicked
- 28:54Speaker 2: within the WebView to open in the same WebView rather
- 28:57Speaker 2: than launching an external browser, keeping the user within your
- 28:59Speaker 2: app up. You could even restrict navigation to only specific domains.
- 29:03Speaker 1: Making it feel more integrated. And just checking connectivity yep, you'd.
- 29:08Speaker 2: Use the Connectivity Manager system service. You could get the
- 29:11Speaker 2: active network info object and check if it was connected
- 29:13Speaker 2: and its type Wi Fi mobile. This required the Internet
- 29:17Speaker 2: and access network state permissions, crucial before attempting any network
- 29:21Speaker 2: operation right now.
- 29:22Speaker 1: The cookbook mentioned a library called Volley as a new
- 29:25Speaker 1: option back in twenty sixteen for network requests, What was
- 29:28Speaker 1: the deal with Volley?
- 29:30Speaker 2: Ah? Volley. Yes, it was introduced by Google and positioned
- 29:33Speaker 2: as a simpler way to handle common network operations compared
- 29:36Speaker 2: to using HTTPURLA connection directly, which involved a lot of
- 29:40Speaker 2: boil play.
- 29:40Speaker 1: Code, so it simplified things it did.
- 29:43Speaker 2: It managed a request queue and a threadpool defaulting to
- 29:47Speaker 2: four threads, automatically handled basic response caching to disc transparently,
- 29:52Speaker 2: and even allowed setting priorities for requests.
- 29:54Speaker 1: Sounds good? What was it best for?
- 29:57Speaker 2: The book highlights that Volley really shown for making law?
- 30:00Speaker 2: What's small network requests efficiently? Think fetching Jason data for
- 30:04Speaker 2: a list or downloading images as a user scrolls. It's
- 30:08Speaker 2: built in support for string Jason and image requests made
- 30:12Speaker 2: these common tasks much easier.
- 30:13Speaker 1: So what were the downsides? The limitations?
- 30:16Speaker 2: The big one mentioned was that Volley was explicitly not
- 30:20Speaker 2: recommended for large downloads or streaming operations. Why not because
- 30:24Speaker 2: it processed and parsed the entire response in memory. Trying
- 30:27Speaker 2: to download a huge file or stream video with Volley
- 30:29Speaker 2: would likely lead to out of memory air crashes. It
- 30:32Speaker 2: just wasn't designed for that. It also had mechanisms for
- 30:34Speaker 2: canceling requests using tags, which was important to avoid wasting
- 30:37Speaker 2: bandwidth if the user navigated away.
- 30:40Speaker 1: So a great tool for specific use cases, but not
- 30:42Speaker 1: a silver bullet for all networking. That's a really important insight. Okay,
- 30:47Speaker 1: we've covered data and connectivity. Now for the final stretch
- 30:51Speaker 1: getting the app ready for the real world, polishing it,
- 30:55Speaker 1: maybe connecting to back end services. What did the cookbook
- 30:58Speaker 1: say about app readiness?
- 30:59Speaker 2: Yeah, and this section really touches on some critical aspects
- 31:02Speaker 2: and it raises that question again, how much of this
- 31:04Speaker 2: twenty sixteen wisdom still applies directly and where have things
- 31:08Speaker 2: fundamentally shifted. One huge shift discussed was the Android six
- 31:11Speaker 2: point zero run time permission.
- 31:13Speaker 1: Model, Right, that was a massive change. Before that, you
- 31:15Speaker 1: just accepted all permissions when installing the app, didn't you exactly?
- 31:18Speaker 2: It was all or nothing. If you didn't like one
- 31:20Speaker 2: permission and app asked for, your only choice was to
- 31:22Speaker 2: not install it. Android six point zero API twenty three
- 31:26Speaker 2: change that completely. Users could now grant or deny permissions
- 31:29Speaker 2: individually at the time the app actually needed them, not
- 31:32Speaker 2: upfronted installation, and they could even revoke permissions later through
- 31:36Speaker 2: the system settings.
- 31:37Speaker 1: Huge win for user privacy and control, But what did
- 31:40Speaker 1: it mean for developers?
- 31:41Speaker 2: It meant a significant code change. Developers now had to
- 31:45Speaker 2: explicitly check if they had a permission using check self permission.
- 31:50Speaker 2: If not, they often needed to show some rationale to
- 31:52Speaker 2: the user explaining why the permission was needed. That was
- 31:55Speaker 2: should show request permission rationale, and then they had to
- 31:59Speaker 2: actually request the prom mission using request permissions and handle
- 32:02Speaker 2: the user's response grant or deny in a callback.
- 32:06Speaker 1: So a lot more interactive permission handling needed.
- 32:08Speaker 2: Definitely. It forced developers to be more thoughtful about the
- 32:11Speaker 2: permissions they requested and when they requested them. A big
- 32:14Speaker 2: step change, but only affected apps running on Android six
- 32:18Speaker 2: point zero plus devices targeting that EPI level or higher.
- 32:21Speaker 1: Okay, what about tasks that needed to run periodically, maybe
- 32:25Speaker 1: even when the app wasn't running, like checking for updates
- 32:28Speaker 1: every few hours.
- 32:29Speaker 2: That was the domain of the alarm manager. You'd use
- 32:32Speaker 2: it to schedule your app to be woken up at
- 32:33Speaker 2: specific times or intervals to perform tasks. The key benefit
- 32:37Speaker 2: was that the OS managed the scheduling. Your app didn't
- 32:40Speaker 2: need to be constantly running in the background, consuming resources.
- 32:44Speaker 2: Just to wake up. Occasionally the OS would wake it
- 32:46Speaker 2: up via intent when the alarm fire.
- 32:49Speaker 1: What kinds of alarms were there?
- 32:50Speaker 2: There were different types based on the clock used. OURTC
- 32:54Speaker 2: used the real time clock wall clock time, while elapsed
- 32:57Speaker 2: real time use the time since the divis I booted,
- 33:00Speaker 2: and there were wake up versions of both which would
- 33:03Speaker 2: actually wake the device CPU if it was asleep when
- 33:05Speaker 2: the alarm fired. Non wake up alarms would only fire
- 33:08Speaker 2: the next time the device woke up for some.
- 33:10Speaker 1: Other reason, and the cookbook had best practices.
- 33:13Speaker 2: Yes, keep alarms in frequent, avoid using wake up alarms
- 33:16Speaker 2: unless absolutely necessary to conserve battery, and use inexact timing
- 33:20Speaker 2: where possible to allow the system to bash alarms together
- 33:23Speaker 2: again for battery efficiency.
- 33:25Speaker 1: Did alarm survive reboots?
- 33:26Speaker 2: Crucially, no alarm manager alarms were cleared when the device rebooted.
- 33:31Speaker 2: If your app needed persistent scheduled tasks, it had to
- 33:34Speaker 2: include a broadcast receiver that listened for the action boot,
- 33:36Speaker 2: completed broadcast, and reschedule its alarms every time the device
- 33:40Speaker 2: started up. A common gotcha.
- 33:42Speaker 1: Ah Okay, now what about that fundamental problem of doing
- 33:45Speaker 1: long running work without freezing the UI we mentioned loaders
- 33:49Speaker 1: for data, But what about other background tasks?
- 33:52Speaker 2: The classic solution, presented in a twenty sixteen cookbook was
- 33:55Speaker 2: acing task Acing task.
- 33:57Speaker 1: Still hear about that one, often not in a good way.
- 33:59Speaker 2: Yeah, yeah, it has a mixed reputation now, But back
- 34:02Speaker 2: then it was a standard, relatively simple way to handle
- 34:05Speaker 2: background work with UI updates. The problem it solves was
- 34:08Speaker 2: clear doing network requests, heavy calculations, or anything slow on
- 34:12Speaker 2: the main UI thread caused the app to hang, leading
- 34:15Speaker 2: to an RS. The rules were simple, don't block the
- 34:19Speaker 2: main thread, do all UI updates on the main thread.
- 34:22Speaker 1: So how did acy task help?
- 34:24Speaker 2: It provided a simple structure. You'd override do end background,
- 34:27Speaker 2: which ran on a background worker thread. That's where you
- 34:30Speaker 2: put your long running code. When doing background finished, it
- 34:33Speaker 2: could return a result. Then on post execute, which automatically
- 34:37Speaker 2: ran back on the main UI thread, received that result,
- 34:40Speaker 2: allowing you to safely update your UI like showing the
- 34:42Speaker 2: downloaded data or hiding a progress bar. It also had
- 34:45Speaker 2: on pre execute UI thread before and on progress update
- 34:49Speaker 2: UI thread for progress.
- 34:50Speaker 1: Sounds straightforward enough, What were the catches? Why the bad reputation? Now?
- 34:54Speaker 2: The main issue hinted at even in the cookbook was
- 34:57Speaker 2: its type coupling with the activity or fragment that started it.
- 35:01Speaker 2: If you started an acing task from an activity and
- 35:04Speaker 2: the user rotated the screen, destroying and recreating the activity
- 35:09Speaker 2: before the task finished, uh oh yeah, the acing task
- 35:12Speaker 2: might hold an implicit reference to the old destroyed activity context.
- 35:16Speaker 2: This could lead to memory leaks, and if the task
- 35:18Speaker 2: tried to update the UI on post execute, it could
- 35:21Speaker 2: crash because the activity was trying to update didn't exist anymore,
- 35:24Speaker 2: or it updated the wrong instance it created.
- 35:26Speaker 1: These orphan tasks so convenient, but fragile if not handled
- 35:31Speaker 1: very carefully.
- 35:32Speaker 2: Extremely That's why the book suggested maybe using it with fragments,
- 35:35Speaker 2: specifically retained fragments or loaders as potentially safer alternatives for
- 35:40Speaker 2: handling background tasks tied to UI life cycles. Modern Android
- 35:43Speaker 2: uses core routines, RX Java or work Manager, which handle
- 35:47Speaker 2: life cycles much more elegantly.
- 35:48Speaker 1: Makes sense. What about other advanced features voice input, push messages.
- 35:52Speaker 2: Yeah, the cookbook touched on those two. Speech recognition was
- 35:55Speaker 2: possible using the Google Speed service available since Android two
- 35:59Speaker 2: point two ap eight. You'd launched an intent to start
- 36:02Speaker 2: the voice recognizer and get the results back. For push notifications,
- 36:06Speaker 2: the standard back then was Google Cloud Messaging GCM.
- 36:09Speaker 1: GCM before FCM, firebased Cloud Messaging.
- 36:12Speaker 2: Exactly, GCM was the predecessor. The architecture involved three parts,
- 36:16Speaker 2: your application server, Google's GCM servers, and the Android device
- 36:19Speaker 2: running your app. The flow was your app registers with
- 36:23Speaker 2: GCM servers to get a unique device registration token. Your
- 36:26Speaker 2: app sends this token to your back end server. When
- 36:29Speaker 2: your server wants to send a push message, it sends
- 36:31Speaker 2: the message content and the token to Google's GCM server.
- 36:34Speaker 2: GCM then handles delivering that message down to the correct.
- 36:37Speaker 1: Device and the app received it.
- 36:39Speaker 2: Yes, the app needed to implement specific services, an instance
- 36:42Speaker 2: I listener service to handle token generation and refresh, and
- 36:45Speaker 2: a GCM listener service with an on message received callback
- 36:48Speaker 2: to actually handle incoming push messages. It worked back to
- 36:51Speaker 2: API eight.
- 36:52Speaker 1: Okay and letting users sign in easily.
- 36:54Speaker 2: Google sign in was becoming common. It allowed users to
- 36:57Speaker 2: sign into your app using their existing Google accase out,
- 37:00Speaker 2: avoiding the need for them to create yet another username
- 37:03Speaker 2: and password. It involved using the Google app a client,
- 37:06Speaker 2: a central entry point for Google APIs back then, and
- 37:09Speaker 2: adding a standard sigin button to your layout. Once signed in,
- 37:12Speaker 2: you could access basic profile info like their name, email, photo, url, etc.
- 37:17Speaker 2: With their permission, of.
- 37:17Speaker 1: Course, streamlining log in okay. Finally, the cookbook looked at
- 37:22Speaker 1: back end as a service BASH options. What was the
- 37:25Speaker 1: idea there?
- 37:26Speaker 2: The idea was simple, Building and maintaining your own server
- 37:29Speaker 2: back end for an app is hard work. You need
- 37:32Speaker 2: server infrastructure, databases, user management, APIs. It's a lot. BASS
- 37:36Speaker 2: providers offered a shortcut. They provided ready made back end infrastructure,
- 37:40Speaker 2: cloud databases, user authentication, push notification services, file storage, serverless functions,
- 37:46Speaker 2: all accessible via NS. That was the pitch. Focus on
- 37:49Speaker 2: the front end experience, let the BASS handle the back
- 37:52Speaker 2: end heavy lifting. The cookbook compared several providers available in
- 37:56Speaker 2: twenty sixteen based on things like their free tiers, monthly users,
- 38:00Speaker 2: API calls, features like push support and storage limits.
- 38:03Speaker 1: Who are some of the players back then?
- 38:05Speaker 2: The book detailed setup for a few app forty two
- 38:09Speaker 2: which seemed focused on games, back endless offering, MBS hosting,
- 38:12Speaker 2: APIs Buddy focusing on device sensors, Kinvey one of the
- 38:17Speaker 2: earlier big players, and notably.
- 38:19Speaker 1: Firebase AH Firebase, which Google had recently acquired around that time.
- 38:24Speaker 2: Exactly Firebase was highlighted particularly for its real time auto syncing,
- 38:27Speaker 2: database authentication, and hosting. Its acquisition by Google signaled a
- 38:31Speaker 2: big push into this bast space. Each provider had slightly
- 38:34Speaker 2: different strength set of processes. Some used MAVE and GRADEL,
- 38:37Speaker 2: others needed manual library inclusion and pricing models. It really
- 38:41Speaker 2: represented an emerging alternative to DIY back ends.
- 38:44Speaker 1: Wow, we've really journeyed back to twenty sixteen ANDREID development.
- 38:48Speaker 1: We've taken this deep dive into the Android Application Development
- 38:51Speaker 1: Cookbooks second Edition, giving you hopefully a really comprehensive tour.
- 38:56Speaker 1: We explored everything from those fundamental activities and intents, the
- 39:00Speaker 1: nuts and bolts of UI design with layouts, styles, themes,
- 39:03Speaker 1: the complexities of data management and life cycle, all those
- 39:06Speaker 1: user interaction points like menus and notifications, right through to
- 39:10Speaker 1: app readiness concerns like run time permissions, background tasks with
- 39:13Speaker 1: ACYNC task and that emerging world of back end as
- 39:16Speaker 1: a service. We really hope this deep dive has given
- 39:19Speaker 1: you more than just a history lesson, maybe a shortcut
- 39:21Speaker 1: to being well informed about a really pivotal time and
- 39:24Speaker 1: Android's evolution, and maybe spark some aha moments about the
- 39:27Speaker 1: core principles that while still drive a lot of mobile
- 39:29Speaker 1: development today, even if the tools look different. It's honestly
- 39:33Speaker 1: fascinating to see how many of those fundamental recipes from
- 39:35Speaker 1: twenty sixteen laid the groundwork, even with all the changes since. So,
- 39:39Speaker 1: as you think about everything we discussed today from twenty sixteen,
- 39:43Speaker 1: you know, wrestling with the activity life cycle manually, the
- 39:45Speaker 1: pitfalls of async task, the early days of malaysious, what
- 39:48Speaker 1: foundational concepts do you think still ring true, maybe as
- 39:52Speaker 1: core design principles, and which parts feel completely alien now
- 39:56Speaker 1: totally revolutionized or abstracted away in modern Android development? And
- 40:00Speaker 1: maybe think about this, what recipes would be absolutely essential
- 40:03Speaker 1: in an Android application development cook book if it were
- 40:05Speaker 1: published to day. What would be the chapter headings reflecting
- 40:08Speaker 1: the biggest shifts and the most critical techniques developers need
- 40:11Speaker 1: to master now compared to back in twenty sixteen,