开发者

Identify calling program

I'm modifying the Android framework so that certain functions provided by the framework behave differently depending on the program calling it. So for example, if I want to alter the method getSimState() to always return SIM_STATE_ABSENT if the program requesting the sim state is from package com.example.app1

Is this possible and if so, is there an SDK API to identify 开发者_如何学编程the requesting app? Thanks.


It's seems to me that such classes like TelephonyManager contain Context object that was used to get manager object. If it's true, you can use Context.getPackageName() to get caller's package name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜