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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.reflectclasses. See here:http://www.google.com/codesearch#k59QJW14udA/android/src/com/google/zxing/client/android/camera/FlashlightManager.java
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
SecurityManagerprotecting access to certain internals too, I don’t know.