Android Pie, the latest release of Android, is officially available to World. In this talk, I will summarize new features and behaviour changes. This session will be useful for developers as well product managers who are getting their apps ready for Android 9.
3. Introduction
● Twitter : hassanabidpk
● Facebook : https://www.facebook.com/hassanabidpk89
● Google Developers Expert - Android since March 2016
● Working at Live Streaming Platform Startup in SIngapore
(BeLive.sg)
● Worked in Seoul (South Korea) for over 5 years (Video Streaming
SDK, Video Editing app)
6. Features 1/2
● Indoor Positioning with Wi-Fi RTT
● Display Cutout
● Notifications
● Multi-camera support
● ImageDecoder for drawables and bitmaps
● Animations
7. Features 2/2
● HDR VP9 Video, HEIF Image Compression
● JobSchedular
● Neural Networks API 1.1
● Accessibility
● Rotation
● Text
9. Indoor Positioning with Wi-Fi RTT
● Use Wi-Fi RTT (Round-Trip-Time) API to measure the distance to
nearby RTT-capable Wi-FI AP (also Wi-Fi Aware devices)
Requirements
● Device Must have 802.11 mcc FTM standard
● Device Must be running Android 9
● Location and Wi-Fi scanning enabled
● Must have ACCESS_FINE_LOCATION permission
● Access-Point must have IEEE 802.11mc
10. Advantages of Indoor Positioning
● Indoor Navigation
● Disambiguated Voice Control
● Location-based Information
● Accuracy of 1-2 meters
Developer guide here
11. Indoor Positioning RTT API
API Name API Level Remarks
RTT Package [doc]
WifiRttManager
28 Full support
12. Display Cutout
● Support latest edge-to-edge screens
● Test using Android Device or Emulator
running Android 9
● DisplayCutout class added
○ getDisplayCutout()
17. Best Practices
● Don't let the cutout area obscure any important text, controls,
or other information
● Avoid hard-coding the status bar height (use
WindowInsetsCompat)
● Use shortEdges or never cutout modes if your app needs to
transition into and out of fullscreen mode
● See more on Android Developers site
18. DisplayCutout API
API Name API Level Remarks
DisplayCutout[doc] 28 Full support
DispalyCutoutCompat[doc] Other API Levels with
androidx support library
androidx.core:core:1.0.0
Full Support
19. Notifications
● Starting in Android 7.0 (API level 24), you could add an
action to reply to messages
● Support for images in Android 9
● Save replies as drafts
● SmartReply
● Identify a group conversation
20. Notifications
// Create new Person.
val sender = Person()
.setName(name)
.setUri(uri)
.setIcon(null)
.build()
// Create image message.
val message = Message("Picture", time, sender)
.setData("image/", imageUri)
val style = Notification.MessagingStyle(getUser())
.addMessage("Check this out!", 0, sender)
.addMessage(message)
21. Notifications
● Android 8.0 introduced Notification Channels
● Blocking channel groups
● New broadcast intent types
○ The Android system now sends broadcast intents when the blocking
state of notification channels and channel groups’ changes
22. Notification API
API Name API Level Remarks
Person[doc] 28 Use with targetSDKVersion
28
Notification.MessagingStyle (Person user) 28 Other constructors are
deprecated
addMessage (CharSequence text, long
timestamp, Person sender)
28 Person Should be null for
messages by the current
use
23. Multi-Camera support
● On devices running Android 9, you can access streams
simultaneously from two or more physical cameras.
● Support for external USB/UVC cameras on supported
devices
● Improvements in Session Parameters to reduce delays
24. ImageDecoder class
● With new ImageDecoder class
○ BitmapFactory
○ BitmapFactory.Options
● Create a Drawable or Bitmap from a byte buffer, file or a
URI
● Decode using decodeDrawable() or decodeBitmap()
● Resizing, Crop, mutable bitmap APIs also available
25. ImageDecoder class
A class for converting encoded images (like PNG, JPEG,
WEBP, GIF, or HEIF) into Drawable or Bitmap objects.
// Step - 1 : Create a Source
// Step - 2 : Decode source
File file = new File(...);
ImageDecoder.Source source = ImageDecoder.createSource(file);
Drawable drawable = ImageDecoder.decodeDrawable(source);
26. ImageDecoder - Change settings
// To Change default settings pass OnHeaderDecoderListener in addition to source
// Following code shows sample image with half the width and height
OnHeaderDecodedListener listener = new OnHeaderDecodedListener() {
public void onHeaderDecoded(ImageDecoder decoder, ImageInfo info,
Source source) {
decoder.setTargetSampleSize(2);
}
};
Drawable drawable = ImageDecoder.decodeDrawable(source, listener);
27. ImageDecoder - GIF and WEBP
@Throws(IOException::class)
private fun decodeImage() {
val decodedAnimation = ImageDecoder.decodeDrawable(
ImageDecoder.createSource(resources, R.drawable.my_drawable))
// Prior to start(), the first frame is displayed.
(decodedAnimation as? AnimatedImageDrawable)?.start()
}
30. HDR VP9 video, HEIF Image
● Android 9 provides support for
HDR VP9 Video Profile 2
● Support for HEIF Image
● You can do a jpeg-to-heic
conversion using ImageDecoder
or BitmapFactory
31. Data cost sensitivity in JobScheduler
● JobScheduler is Android's central service to help you manage
scheduled tasks or work across Doze, App Standby, and
Background Limits
● In Android 9.0, Jobs can declare data size, signal prefetching
and specify network requirements
○ Provided by carrier
32. Neural Network API 1.1.1
● The Neural Networks API was introduced in Android 8.1
(API level 27)
● In Android 9.0, nine new APIS are added
34. Text
● Precomputed Text
● Magnifier
● Smart linkify (TextClassifier)
● TextLayout
● Read more in this blog post
35. PreComputed Text
API Name API Level Remarks
PrecomputedText [doc] 28 Full Support
PrecomputedTextCompat[doc] 21-27 Use internal Text layout
cache
PrecomputedTextCompat 14 - 20 Does Nothing
38. TextView (Text Layout)
API Name API Level Remarks
TextView [doc] Target SDK : 28 New APIS : lineHeight,
firstBaselineToTopHeight,
lastBaselineToBottomHeigh
t
39. Slices
● Slices are UI templates that can display rich, dynamic, and
interactive content from your app from within the Google Search
app and the Google Assistant
● Developer Guide
41. Security
● Apps no longer need to build
their own dialog--instead they
use the BiometricPrompt API to
show the standard system
dialog
● HTTPS by default
47. Summary
● Android Pie SDK is now more Kotlin friendly
● Display Cutout
● Notifications
● TextClassifier enhancements using Machine Learning
● Slices
● ImageDecoder
● New System Navigation
● Etc.