Top Banner
Next Time Fragment coding CustomView
34

Lesson 6. Services and Notifications

Jul 16, 2015

Download

Software

Chanhyeong Lee
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lesson 6. Services and Notifications

Next����������� ������������������  Time…⋯

•Fragment����������� ������������������  coding����������� ������������������  

•CustomView

Page 2: Lesson 6. Services and Notifications

Build����������� ������������������  2-Pane����������� ������������������  Table����������� ������������������  UI

Page 3: Lesson 6. Services and Notifications

Build����������� ������������������  2-Pane����������� ������������������  Table����������� ������������������  UI

•How����������� ������������������  to����������� ������������������  build����������� ������������������  up����������� ������������������  the����������� ������������������  two-pane����������� ������������������  table����������� ������������������  UI����������� ������������������  

•Create����������� ������������������  a����������� ������������������  new����������� ������������������  layout����������� ������������������  sw600dp����������� ������������������  folder����������� ������������������  and����������� ������������������  new����������� ������������������  file����������� ������������������  called����������� ������������������  activity_main.xml

Page 4: Lesson 6. Services and Notifications

Handle����������� ������������������  List����������� ������������������  Item����������� ������������������  Click

Page 5: Lesson 6. Services and Notifications

Handle����������� ������������������  List����������� ������������������  Item����������� ������������������  Click

•Use����������� ������������������  callback����������� ������������������  to����������� ������������������  notify����������� ������������������  activity����������� ������������������  of����������� ������������������  list����������� ������������������  item����������� ������������������  selection����������� ������������������  

•on����������� ������������������  phone,����������� ������������������  launch����������� ������������������  DetailActivity����������� ������������������  

•on����������� ������������������  Tablet,����������� ������������������  launch����������� ������������������  DatailFragment

Page 6: Lesson 6. Services and Notifications

Activated����������� ������������������  List����������� ������������������  item����������� ������������������  Style

•StateListDrawable����������� ������������������  

•touch_selector.xml����������� ������������������  ->����������� ������������������  정의����������� ������������������  

•list_item_forecast.xml����������� ������������������  ->����������� ������������������  적용����������� ������������������  

•fragment_main.xml����������� ������������������  ->����������� ������������������  선택����������� ������������������  모드

Page 7: Lesson 6. Services and Notifications

Custom����������� ������������������  Views

Page 8: Lesson 6. Services and Notifications

Custom����������� ������������������  Views

•onMeasure()����������� ������������������  

•onDraw()

Page 9: Lesson 6. Services and Notifications

Custom����������� ������������������  Views

Page 10: Lesson 6. Services and Notifications

Lesson����������� ������������������  5����������� ������������������  Recap

•How����������� ������������������  to����������� ������������������  create����������� ������������������  rich����������� ������������������  UI����������� ������������������  

•How����������� ������������������  to����������� ������������������  create����������� ������������������  custom����������� ������������������  view

Page 11: Lesson 6. Services and Notifications

Lesson����������� ������������������  6.����������� ������������������  Services����������� ������������������  and����������� ������������������  Notifications

도우미����������� ������������������  이찬형

Page 12: Lesson 6. Services and Notifications

Intro����������� ������������������  to����������� ������������������  Lesson����������� ������������������  6

•How����������� ������������������  it����������� ������������������  should����������� ������������������  operate����������� ������������������  when����������� ������������������  It’s����������� ������������������  not����������� ������������������  in����������� ������������������  the����������� ������������������  foreground����������� ������������������  

•Service����������� ������������������  

•efficient����������� ������������������  data����������� ������������������  transfers����������� ������������������  using����������� ������������������  sync����������� ������������������  adapters����������� ������������������  and����������� ������������������  Google����������� ������������������  Cloud����������� ������������������  messaging

Page 13: Lesson 6. Services and Notifications

Sunshine����������� ������������������  in����������� ������������������  the����������� ������������������  Background

•The����������� ������������������  AsyncTask����������� ������������������  is����������� ������������������  not����������� ������������������  tied����������� ������������������  to����������� ������������������  the����������� ������������������  activity����������� ������������������  life����������� ������������������  cycle����������� ������������������  

•If����������� ������������������  you����������� ������������������  rotate����������� ������������������  your����������� ������������������  phone,����������� ������������������  the����������� ������������������  behavior����������� ������������������  is����������� ������������������  to����������� ������������������  destroy����������� ������������������  your����������� ������������������  activity����������� ������������������  and����������� ������������������  instantiate����������� ������������������  a����������� ������������������  new����������� ������������������  one.

Page 14: Lesson 6. Services and Notifications

App����������� ������������������  Lifecycle����������� ������������������  and����������� ������������������  Service

•with����������� ������������������  invisible����������� ������������������  state,����������� ������������������  downloading����������� ������������������  files,����������� ������������������  uploading����������� ������������������  photos����������� ������������������  or����������� ������������������  playing����������� ������������������  music����������� ������������������  

•Services����������� ������������������  -����������� ������������������  no����������� ������������������  user����������� ������������������  interface,����������� ������������������  a����������� ������������������  higher����������� ������������������  priority����������� ������������������  than����������� ������������������  background����������� ������������������  activity

Page 15: Lesson 6. Services and Notifications

Services����������� ������������������  Life����������� ������������������  Cycle

Page 16: Lesson 6. Services and Notifications

Services����������� ������������������  Priority

Page 17: Lesson 6. Services and Notifications

Intent����������� ������������������  Service

Page 18: Lesson 6. Services and Notifications

Application����������� ������������������  Priority

Page 19: Lesson 6. Services and Notifications

Application����������� ������������������  Priority

Page 20: Lesson 6. Services and Notifications

Using����������� ������������������  Services

•SunshineService����������� ������������������  -����������� ������������������  FetchWeatherTask����������� ������������������  

•AndroidManifest.xml����������� ������������������  

•updateWeather����������� ������������������  -����������� ������������������  startService()

Page 21: Lesson 6. Services and Notifications

•Service����������� ������������������  still����������� ������������������  doesn’t����������� ������������������  wake����������� ������������������  itself����������� ������������������  up����������� ������������������  

•BroadcastReceiver����������� ������������������  

•AndroidManifest.xml����������� ������������������  

•AlarmManager

Using����������� ������������������  Alarms

Page 22: Lesson 6. Services and Notifications

•less����������� ������������������  Data,����������� ������������������  less����������� ������������������  often

Transferring����������� ������������������  Data����������� ������������������  Efficiently

Page 23: Lesson 6. Services and Notifications

The����������� ������������������  Cell����������� ������������������  Radio

Page 24: Lesson 6. Services and Notifications

Little����������� ������������������  Cookie����������� ������������������  Approach

Page 25: Lesson 6. Services and Notifications

Big����������� ������������������  Cookie����������� ������������������  Model

Page 26: Lesson 6. Services and Notifications

Big����������� ������������������  Cookie����������� ������������������  Model

Page 27: Lesson 6. Services and Notifications

Data����������� ������������������  transfer����������� ������������������  Best����������� ������������������  Practices

•single����������� ������������������  connection����������� ������������������  

•single����������� ������������������  burst����������� ������������������  

•full����������� ������������������  capacity

Page 28: Lesson 6. Services and Notifications

Introducing����������� ������������������  SyncAdapters•SyncManager

Page 29: Lesson 6. Services and Notifications

Introducing����������� ������������������  SyncAdapters

•Schedules����������� ������������������  your����������� ������������������  network����������� ������������������  jobs����������� ������������������  with����������� ������������������  other����������� ������������������  apps����������� ������������������  

•Has����������� ������������������  logic����������� ������������������  to����������� ������������������  retry����������� ������������������  your����������� ������������������  request

Page 30: Lesson 6. Services and Notifications

Implementing����������� ������������������  a����������� ������������������  SyncAdapter

•AndroidManifest.xml����������� ������������������  -����������� ������������������  선언,����������� ������������������  퍼미션����������� ������������������  

•Authenticator����������� ������������������  

•AuthenticatorService����������� ������������������  

•SyncAdaptor����������� ������������������  

•SyncAdaptorService

Page 31: Lesson 6. Services and Notifications

Google����������� ������������������  Cloud����������� ������������������  messaging

•Sync����������� ������������������  per����������� ������������������  a����������� ������������������  click����������� ������������������  ->����������� ������������������  periodic����������� ������������������  sync

Page 32: Lesson 6. Services and Notifications

Notifications

•string.xml����������� ������������������  -����������� ������������������  format����������� ������������������  

•SunshineSyncAdapter����������� ������������������  -����������� ������������������  notifyWeather����������� ������������������  

•etc����������� ������������������  -����������� ������������������  noti����������� ������������������  on/off,����������� ������������������  delete����������� ������������������  old����������� ������������������  data,����������� ������������������  update����������� ������������������  map����������� ������������������  location

Page 33: Lesson 6. Services and Notifications

Lesson����������� ������������������  6����������� ������������������  Recap

•How����������� ������������������  to����������� ������������������  use����������� ������������������  services����������� ������������������  and����������� ������������������  think����������� ������������������  adapters����������� ������������������  

•Creating����������� ������������������  rich����������� ������������������  notification

Page 34: Lesson 6. Services and Notifications

Congratulation����������� ������������������  !����������� ������������������  Android����������� ������������������  Party����������� ������������������  !