Android O 프리뷰 핵심 요약: 주요 변경 사항과 새로 추가된 기능을 소개합니다!

안드로이드 O

구글은 한국 시각으로 3월 22일 안드로이드의 최신 버전 안드로이드 O 개발자 프리뷰 1를 배포했습니다. 아직 개발자 프리뷰이기 때문에 안정성이 부족하며 공식적인 이름이 정해지지 않았죠. 안드로이드는 관행적으로 알파벳 순서로 이름을 짓기 때문에 누가 다음 버전의 안드로이드는 알파벳 O로 시작하게 되며, 새 버전도 예외 없이 안드로이드 O로 공개되었습니다. 출시 명이 오레오라는 소문이 있지만, 공식적으로 확인된 것은 아닙니다.

이전 K 시절 안드로이드 이름이 키라임 파이라는 설이 허다했지만, 공식적인 이름이 킷캣이 된 해프닝을 기억하는 분들도 계실 것 같네요.

프리뷰 일정

일정 이미지

안드로이드 개발자 프리뷰 1은 3월 중순에 공개됐고 개발자 프리뷰 2는 5월 중순, 개발자 프리뷰 3은 6월 중순, 개발자 프리뷰 4는 7월 중순, 정식 버전 출시는 3분기로 정해져 있습니다. 시기적으로 볼 때 개발자 프리뷰 2의 공개 시점은 구글의 개발자 행사인 구글 IO일 가능성이 높아 보입니다.

개발자 프리뷰 3에서 API가 확정되고 그 이후인 프리뷰 4와 정식 버전은 안정화 단계로 보면 됩니다.

호환성 체크

다음의 몇 가지 항목은 안드로이드 O에서 크게 변화한 부분입니다. 앱의 호환성을 위해 다음 항목을 참고하세요.

  • 백그라운드 앱은 시간당 일정 횟수 이상의 위치 정보를 받을 수 없습니다.
  • 더는 net.hostname을 사용할 수 없습니다.
  • connect(InetAddress, int) 호출이 실패한 후 send(DatagramPacket)을 호출하면 SocketException이 발생합니다.
  • AbstractCollection.removeAll(null)AbstractCollection.retainAll(null)이 Null Pointer 예외를 던집니다.
  • Currency.getDisplayName(null)도 Null Pointer 예외를 던집니다.
  • net.dns1, net.dns2, net.dns3, net.dns4 속성이 없습니다.
  • 네이티브 라이브러리는 데이터를 실행 가능으로 하거나 코드를 쓰기 가능으로 하면 안됩니다.
  • ELF 헤더와 부분을 더 엄격하게 검사합니다.
  • 안드로이드 O를 타깃으로 하는 앱은 하나 이상의 알림 채널을 가져야 합니다.
  • 리스트 구현에서 Collections.sort()를 호출하면 ConcurrentModificationException가 발생합니다.

안드로이드 O 추가 기능

안드로이드 O에는 많은 기능이 추가될 예정입니다. 그중 주요 기능 몇 가지를 살펴 볼까요?

알림 채널

안드로이드 O를 타깃으로 하는 앱은 하나 이상의 알림 채널을 만들어야 합니다. 개별 알림에 대한 중요도는 폐지되고 채널 단위로 중요도를 설정할 수 있습니다. 채널에 대해서 사용자는 중요도, 소리, 빛, 진동, 락스크린에 표시 여부, 방해 금지 등을 설정할 수 있습니다.

이런 개발 뉴스를 더 만나보세요

채널은 다음처럼 간단하게 생성할 수 있습니다.


NotificationManager mNotificationManager =
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// The id of the channel.
String id = "my_channel_01";
// The user visible name of the channel.
CharSequence name = getString(R.string.channel_name);
int importance = NotificationManager.IMPORTANCE_LOW;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
// Configure the notification channel.
mChannel.enableLights(true);
// Sets the notification light color for notifications posted to this
// channel, if the device supports this feature.
mChannel.setLightColor(Color.RED);
mChannel.enableVibration(true);
mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
mNotificationManager.createNotificationChannel(mChannel);

채널로 알림을 보내는 것도 간단합니다.


mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// Sets an ID for the notification, so it can be updated.
int notifyID = 1;
// The id of the channel.
String CHANNEL_ID = "my_channel_01";
// Create a notification and set the notification channel.
Notification notification = new Notification.Builder(MainActivity.this)
        .setContentTitle("New Message")
        .setContentText("You've received new messages.")
        .setSmallIcon(R.drawable.ic_notify_status)
        .setChannel(CHANNEL_ID)
        .build();
// Issue the notification.
mNotificationManager.notify(id, notification);

노티피케이션 그룹 설정

픽쳐 인 픽쳐 (Picture-in-Picture)

픽쳐 인 픽쳐는 완전히 새로운 기능은 아닙니다. 안드로이드 누가 버전에서 TV 장비를 쓸 경우에는 쓸 경우에는 픽쳐 인 픽쳐를 쓸 수 있었죠. 하지만 그 외의 경우에는 화면 분할 모드를 사용해야 했습니다.

화면 분할 모드

픽쳐 인 픽쳐

TV 장비에서 픽쳐 인 픽쳐가 실행된 화면입니다.

멀티 윈도를 쓸 때는 onPause()에서 영상을 멈추는 것과 onResume()에서 재생하는 것을 하는 것 대신에 onStop()onStart()에서 대응해야 합니다.

폰트

이제 폰트를 리소스에 추가하고 레이아웃에 적용하는 것이 가능해집니다.


<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
    <font
        android:fontStyle="normal"
        android:fontWeight="400"
        android:font="@font/lobster_regular" />
    <font
        android:fontStyle="italic"
        android:fontWeight="400"
        android:font="@font/lobster_italic" />
</font-family>

폰트를 만들고 나서 다음과 같이 적용하면 됩니다.


<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/lobster"/>
        

적응형 아이콘 (Adaptive icon)

어답티브 아이콘

원형의 아이콘이 적합한 상황에서는 원형의 아이콘을 표시하고 그렇지 않은 단말에서는 사각형의 아이콘을 출력할 수 있습니다.


<application
    // …
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    // …
>
</application>


<adaptive-icon>
    <background android:drawable="@color/ic_background"/>
    <foreground android:drawable="@mipmap/ic_foreground"/>
</adaptive-icon>

주의: 공식문서는 adaptive-icon 태그 대신 maskable-icon 태그를 사용합니다. 하지만 issue36535386 이슈에 따르면 우리는 adaptive-icon를 사용해야 합니다.

더 나아가기

구글의 안드로이드 프리뷰 페이지에서 더 다양한 기능들을 확인해보세요.

다음: Realm Java의 새로운 기능을 만나 보세요!

General link arrow white

컨텐츠에 대하여

이 컨텐츠는 저자의 허가 하에 이곳에서 공유합니다.


김용욱

Leonardo YongUk Kim is a software developer with extensive experience in mobile and embedded projects, including: several WIPI modules, iOS projects, a scene graph engine for Android, an Android tablet, a client utility for black boxes, and some mini games using Cocos2d-x. He has also developed many open source projects.

Additionally, Leonardo has been an organizer of GDG Korea Android for the last several years. To date, he has organized conferences, codelabs, hackathons, and meetups.

4 design patterns for a RESTless mobile integration »

close