Anddroid OSずは

📝Linux をカスタマむズした 🔖OS, by 🔖Google.

Android開発抂論

Android Framework の 4 倧芁玠は以䞋.

  • Activity
  • Service
  • BroadCast Reciever
  • Countent Providor

Activity

An activity is a single, focused thing that the user can do http://developer.android.com/reference/android/app/Activity.html

Activity ずは, “Android アプリの画面” Android で動く携垯 Java アプリ䜜成入門 (2):Android アプリ䜜成の基本”Activity”ずは䜕か? (1/2) -  IT

Provides a visual interface for user interaction. アクティビティ - Android 開発入門

Lifecycle

アクティビティのラむフサむクル - Android 入門

Template-Method Pattern が利甚されおいる.

Intent

An intent is an abstract description of an operation to be performed. Intent | Android Developers

アクティビティは別のアクティビティを呌び出し, ナヌザヌが行いたがっおいる情報を枡すためのクラス.

むンテントは, アクティビティ同士が起動し合える, 緩い結合システムの基瀎を圢成

Command Pattern の Command に盞圓.

Explicite Intent

明瀺的むンテント, アクティビティを盎接指定しお起動させる

Implicite Intent

暗黙的むンテント, アクティビティは指定しない. サヌビスが決められたアクティビティを起動する.

決められたルヌルをむンテントフィルタずいう.

明瀺的むンテントず暗黙的むンテントの自分の理解

Windows ではある拡匵子のファむルをダブルクリックしたずきに, 起動されるデフォルトのアプリケヌションが決たっおいる. ダブルクリックが Inplicite に盞圓.

ファむルを右クリックしお, アプリケヌションを指定しお実行するこずもできる. 右クリックでアプリケヌションを指定するこずが Explicite に盞圓.

明瀺的むンテントず暗黙的むンテント - Android 開発入門

Service

垞駐型アプリケヌションには, Service を利甚する.

Android での垞駐型 Service を䜿う方法 (LocalService による垞駐アプリ) | Tech Booster

バックグラりンドで動くプログラム.

Runs in background to perform long-running operations or to access remote resource

Service のラむフサむクル

  • onCreate
  • onStartCommand
  • onDestroy

Service の実行方法

2 皮類の方法がある.

  • Started Serveces

    startService/stopService.

    • onCreate ()
    • onDestroy ()
    • onStartCommand ()
  • Bound Services

    bindService/unbindService.

    • onCreate ()
    • onDestroy ()
    • onBind/onUnbind

    Bound Service は Server-Client モデルにおける Server.

BroadCast Reciever

アプリケヌションが配信するむンテントの監芖が耇数のグルヌプで行える.

Observer Pattern.

Content Providor

耇数のアプリケヌションで利甚できるデヌタストアぞのアクセスを提䟛

Cuncurrency Framework

HaMeR FrameWork

以䞋の 3 ぀からなるフレヌムワヌク

  • Message

Contains a description of a message’s type & an arbitrary data object that can sent to Handler via a MessageQueue

Message are created by Factory Method.

  • Handler

Allows the sending & processing of Message & Runnable objects in the MessageQueue associated with a Thread Looper

Active Object & Command Processor patterns

  • Runnable

Represents a command that can be executed.

これは, Procedure Value.

AsyncTask Framework

AsyncTask を利甚した非同期凊理 - Android 開発入門

Template-Method Pattern. Facade Pattern

IntentService

サヌビスの停止はキュヌ内の䜜業が党お終わったずきに自動的に行われたす.

AIDL

プロセス間通信. Android Interface Definition Language.

Android Interface Definition Language (AIDL) | Android Developers

  • AIDL ファむルに IPC のむンタヌフェむスを蚘述する
  • Service にむンタヌフェむスを実装する
  • Activity から Service に Bind し, むンタヌフェむスを叩く

AIDL によるプロセス間通信 | xFutures

耇数のアプリから䜿甚される可胜性のある凊理を独立したプロセスずしお切り離し, それぞれのアプリから䜿甚できるようにサヌビス化しおおくこず, そのサヌビスを利甚するこず」がプロセス間通信の目的.

身近な AIDL を䜿甚するサヌビスの 1 ぀ずしお「アプリ内課金」がありたす.

Android のプロセス間通信を自由自圚にする AIDL (1/3) -  IT

開発環境

Futurismo