6/6の記事でACTION_EXTERNAL_APPLICATIONS_AVAILABLE というインテントを拾えばSDカードのアプリを再起動できそうだと書きましたが、あれはできませんでした。
ので、残念ながらEasyRotationは外部ストレージにインストールした場合、再起動時の自動起動オプションは無効になります。
申し訳ありません。
コードを書き直すも上手く動かず、疑問に思いながらインテントの方のリファレンスを読み込んだところ、外部ストレージにインストールされているアプリではこのインテントを受け取れないようなことが書いてありました。
サービスはこのインテントで走らせられる様なことが書いてあった気がしたんですが、アプリが本体側にあってストレージのデータを参照する必要があるサービスを動かせるとかそんなところだったのかなぁ……
以下、Androidのリファレンスから引用。太字部分が該当箇所です。
public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
Since: API Level 8
Broadcast Action: Resources for a set of packages (which were previously unavailable) are currently available since the media on which they exist is available. The extra data EXTRA_CHANGED_PACKAGE_LIST contains a list of packages whose availability changed. The extra data EXTRA_CHANGED_UID_LIST contains a list of uids of packages whose availability changed. Note that the packages in this list do not receive this broadcast. The specified set of packages are now available on the system.
6/6の記事でACTION_EXTERNAL_APPLICATIONS_AVAILABLE というインテントを拾えばSDカードのアプリを再起動できそうだと書きましたが、あれはできませんでした。
インテントの方のリファレンスを読み込んだところ、外部祖トレー時にインストールされているアプリではこのインテントを受け取れないようなことが書いてありました。
以下リファレンスから引用
public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
Since: API Level 8
Broadcast Action: Resources for a set of packages (which were previously unavailable) are currently available since the media on which they exist is available. The extra data EXTRA_CHANGED_PACKAGE_LIST contains a list of packages whose availability changed. The extra data EXTRA_CHANGED_UID_LIST contains a list of uids of packages whose availability changed. Note that the packages in this list do not receive this broadcast. The specified set of packages are now available on the system.
Includes the following extras:
EXTRA_CHANGED_PACKAGE_LIST is the set of packages whose resources(were previously unavailable) are currently available. EXTRA_CHANGED_UID_LIST is the set of uids of the packages whose resources(were previously unavailable) are currently available.
This is a protected intent that can only be sent by the system.
Constant Value: “android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE”