Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はAndroidアプリケーションでサービスを持っています。このサービスは、aidlを介して他のアプリケーションのインターフェースを公開します。サービスのメソッドを呼び出すアプリケーションのアプリケーションパッケージを知りたいのですが。出来ますか?
もちろん、HashMapを保存して、呼び出し先ごとに新しいバインダーを作成することはできますが、それは私にとってひどい解決策のようです。
何か案は?ありがとう。
実際、私はそれがうまくいくとは思いません。AFAIK、AndroidはあなたをキャッシュしますBinder、または少なくとも個別にキャッシュしますIntent。
Binder
Intent
何か案は?
内の任意のメソッドを使用getCallingUid()して、そのメソッドの呼び出しをトリガーしたユーザーを確認します。getCallingPid()Binder
getCallingUid()
getCallingPid()