LoginSignup
11
15

More than 5 years have passed since last update.

ServiceをAIDLを使って弄ぶ練習

Last updated at Posted at 2014-12-25

前回(端末に新規アプリがインストールされたらログを吐く)に引き続き、Serviceの利用方法とか、ほとんど覚えていないので、 Service の超簡単なサンプルを作成したのでメモを残す。

概要

ServiceAIDLを使って、アプリから利用サンプル。
複数アプリから同じサービスを参照して遊びタイので、Implicit intents with startService are not safeって出ても気にしないでokなはず。

AndroidManifestにServiceを定義する際のリファレンスをすぐに忘れるので残す。

実装

GitHubにサンプルソースを置きました

だいたい下記ファイルを眺めればわかるかと。

備忘

僕はサンプル作成にAndroidStudioを利用しています。
ディレクトリ構成を標準のまま使っており、aidleディレクトリが参照されず、しばし空を見つめました。

build.gradleのandroidブロックに下記を書けば、okokでした。

AndroidManifest.xml
sourceSets{
    main{
        aidl.srcDirs = ['src/main/aidl']
    }
}
11
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
15