Reputation: 357
Can anyone tell me, how to import Android hidden/internal API's into my application?
For example, com.android.internal.telephony
. How to import this APi into application?
Thanks in advance.
Upvotes: 1
Views: 1033
Reputation: 66886
If the classes are available at runtime, but not compile time, yes you can't compile against them directly in your code but you can still try to load them via reflection. We used this in Android 1.x to load a hidden internal class that controlled the LED light on some devices. It is difficult since every method call turns into several lines of calls to java.lang.reflect
classes. See here:
Of course, these APIs or classes would not at all be guaranteed to be present on all devices, and could change or disappear, so this is brittle. And it may be that there's a SecurityManager
protecting access to certain internals too, I don't know.
Upvotes: 2