Upgrade to Pro — share decks privately, control downloads, hide ads and more …

3分で作れる夢のサービス

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 3分で作れる夢のサービス

結局5分くらいかかるけど

Avatar for punchdrunker

punchdrunker

July 31, 2015
Tweet

More Decks by punchdrunker

Other Decks in Programming

Transcript

  1. Daydream • API level 17+ • ようはスクリーンセーバー • DreamService (extends

    Service) を利用して 実装できる • 既存アプリへの組込みも簡単
  2. DreamService • New File > Other > DaydreamServiceでカン タン作成 (...のはずだった)

    • API Level 21+は追加仕様としてpermissionの 定義が必要なので注意 <service android:name=".MyDream" android:exported="true" android:permission="android.permission.BIND_DREAM_SERVICE" ...
  3. Lifecycle of DreamService • onAttachedToWindow() ◦ Use this for initial

    setup, such as calling setContentView(). • onDreamingStarted() ◦ Your dream has started, so you should begin animations or other behaviors here. • onDreamingStopped() ◦ Use this to stop the things you started in onDreamingStarted(). • onDetachedFromWindow() ◦ Use this to dismantle resources (for example, detach from handlers and listeners).
  4. Demo • プロジェクト作成(API 17) • Activity不要 • DaydreamServiceの追加 • permissionも追加

    • MyDaydreamService.javaで実装 ◦ wordsを追加 ◦ ランダムに表示してみる ◦ 雛形のままだと終了時に落ちるので注意